The Omni Group Forums

The Omni Group Forums (http://forums.omnigroup.com/index.php)
-   OmniFocus Extras (http://forums.omnigroup.com/forumdisplay.php?f=44)
-   -   Applescript to Paste from Clipboard (http://forums.omnigroup.com/showthread.php?t=19386)

richgoidel 2010-12-13 12:58 PM

Applescript to Paste from Clipboard
 
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.

whpalmer4 2010-12-13 02:22 PM

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

[/code]

RobTrew 2010-12-13 03:00 PM

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[/CODE]


All times are GMT -8. The time now is 03:48 AM.

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