The Omni Group
These forums are now read-only. Please visit our new forums to participate in discussion. A new account will be required to post in the new forums. For more info on the switch, see this post. Thank you!

Go Back   The Omni Group Forums > OmniFocus > OmniFocus Extras
FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
Applescript to Paste from Clipboard Thread Tools Search this Thread Display Modes
Does anyone know if it's possible to script pasting from the clipboard to the current cursor location in a note? I'm a PHP guy, but can get around in applescript if someone can provide an example.
 
The following snippet illustrates the process by setting the clipboard contents to "Hi Mom!" and then pasting them into the insertion point in the frontmost OmniFocus window by simulating the user pressing command-V.

Code:
set the clipboard to "Hi Mom!"

tell application "OmniFocus"
	activate
	tell application "System Events"
		keystroke "v" using {command down}
	end tell
end tell
 
and, FWIW, you can get formatted text by combining simple html markup with the textutil and pbcopy commands.

Code:
do shell script "echo " & quoted form of "<i>Hello</i> Mom!" & ¬
	" | textutil -format html -convert rtf -stdin -stdout | pbcopy -Prefer rtf"

tell application id "com.omnigroup.omnifocus"
	activate
	tell application id "com.apple.systemevents"
		keystroke "v" using {command down}
	end tell
end tell
 
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Paste any lines in Clipboard as new tasks RobTrew OmniFocus Extras 25 2011-09-16 02:07 PM
Applescript to capture list of actions to clipboard JohnJ80 OmniFocus Extras 20 2011-03-25 11:19 AM
Applescript to Save Clipboard to Clippings? jamespro OmniOutliner 3 for Mac 0 2011-03-23 12:11 PM
Copy Actions and/or Projects to Clipboard carlsson OmniFocus 1 for Mac 3 2010-05-31 01:27 AM
Open Tab with URL in clipboard eps5 OmniWeb Feature Requests 2 2008-11-10 07:40 PM


All times are GMT -8. The time now is 07:15 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.