Create a new Sticky widget from entered text

May 29, '09 07:30:03AM

Contributed by: llee

The following AppleScript asks you for some text, copies it to the clipboard, then creates a new Sticky widget and pastes the text you entered. Here's the code:

set the clipboard to text returned of (display dialog "Enter some text for your new Sticky widget..." default answer "Note: ")

set stickywidget to ((path to startup disk) as Unicode text) & "Library:Widgets:Stickies.wdgt"
tell application "Finder" to open stickywidget
delay 1
tell application "System Events"
   keystroke tab
   delay 0.2
   keystroke tab
   delay 1
   keystroke "v" using {command down}
end tell
The two delay lines may need adjustment for different systems; experiment to find what works for you. Once you have the script working, use something like Fastscripts, QuickSilver, Proxi, QuicKeys, etc. to assign it a keyboard shortcut for fast activation. This should work in either Tiger or Leopard.

[robg adds: This worked for me as described on my Mac Pro (no editing of the delays was required).]

Comments (11)


Mac OS X Hints
http://hints.macworld.com/article.php?story=2009052714461214