Making it slower is the key. The problem that happens here is that
Stickies is not quite ready to receive the keystroke at the time it is
sent. The delay I suggested is mean to provide a little extra padding
so that Stickies can get itself ready before the keystroke is sent.
tell application "Stickies" to activate
delay 0.1
tell application "System Events" to keystroke "n" using {command
down}
On Jul 22, 10:37 am, Rebecca O'Connell <[email protected]> wrote:
> I had the same problem with the trigger. My usual trick of adding
> "tell AppleScript to..." before the "tell app "whatever"" call didn't
> work. (I don't actually know why that would ever have an effect, but
> sometimes it does.) Saving the script as an application made it work,
> but it also makes the script run a little slower.
>
> On Jul 22, 2009, at 2:44 AM, Jon Stovell (a.k.a. Sesquipedalian) wrote:
>
>
>
>
>
> > It works for me as is. You could try adding a "delay 0.1" between the
> > activation and the keystroke. But a better plan would be to paste the
> > text of your script as posted above straight into the first pane of
> > the trigger, and choose Run as Applescript in the second pane. Then QS
> > will run it all itself, instead of calling an outside script.
>
> > On Jul 21, 8:28 pm, 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?