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.
|
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] |
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.