I just tried it under heavy systems load where it took Stickies.app about 5 to 10 seconds to start up and it still opened a new sticky after the launch was complete.
Which seems to somewhat confirm my theory that targeting the application process makes keystroke requests go to the event runloop of the process with the name given to "application process". Events are queued in the event runloop so even if they cannot fire right away they will eventually. On 26 Aug., 00:15, andreb <[email protected]> wrote: > Try > > ------------------------- > Make New Sticky.scpt > ------------------------- > using terms from application "Quicksilver" > tell application "Stickies" to activate > > tell application "System Events" > tell application process "Stickies" to keystroke "n" using > {command > down} > end tell > end using terms from > ------------------------- > > I know another nested tell is usually bad, but from what I understand > making the "application process" (a class inside the System Events > dictionary) the target sends the AppleEvent codes to the process with > the PID of the Stickies app. And 'using terms from application > "Quicksilver' makes Quicksilver recognize it as an object and you > don't need to browse to the actual physical location on disk of the > "Make New Sticky.scpt" file when you want to call the "Run" action on > it. > > I saved that AppleScript inside ~/Library/Application Support/ > Quicksilver/Actions, gave it the Icon of "Stickies.app" (using the > Icon Grabber.qsplugin (excellent plugin, found elsewhere on the net)) > and restarted Quicksilver (I am using QS b56 v3820 btw). > Now whenever I type "mknews" it finds the Make New Sticky.scpt treats > it like an Object and I can call the Run action on it. Which on my > system has the result of Stickies.app apearing and greeting me with a > new empty note. For me this works reliably even in fast succesion. > > HTH, > > André > > On 22 Jul., 02:28, Philosopher Dog <[email protected]> wrote: > > > Hi, > > the following script works when I run it in script editor > > > tell application "Stickies" to activate > > tell application "System Events" to keystroke "n" using {command down} > > > It brings stickies to the forefront and creates a new stickie note. > > Very handy. However, when I save the script and run it from a trigger > > in QS it just brings Stickies to the front, but no new note is > > created. Help! What's gone wrong here?
