2

I have set up a workflow using Alfred. The workflow opens a bunch of applications. As a part of this workflow, I also want Stay to restore the window positions to the preset arrangement I have created.

For Stay, I use the "global" keyboard command Shift + + Å to restore the windows. This keyboard shortcut is set in the application's preferences.

I have created this NSAppleScript in Alfred:

on alfred_script(q)
delay 5
tell application "System Events"
    keystroke "Å" using shift down, command down
end tell
activate application "Evernote"
end alfred_script

However, I can't get it to work. I'm getting these errors according to the Alfred workflow debug:

[ERROR: alfred.workflow.action.applescript] {
    NSAppleScriptErrorBriefMessage = "Expected end of line but found \U201c,\U201d.";
    NSAppleScriptErrorMessage = "Expected end of line but found \U201c,\U201d.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {92, 1}";
}

enter image description here enter image description here

P A N
  • 5,642
  • 15
  • 52
  • 103

1 Answers1

2

The keystroke / key code command using > 1 modifier keys needs curly brackets:

keystroke "Å" using {shift down, command down}

AppleScript Language Guide

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • Thanks for pointing that out. I actually had curly brackets but removed them after seeing some examples where they weren't included. It seems like it's working now! – P A N Dec 29 '15 at 19:58
  • There are several ways actually (eg. `option down & shift down`), which is convenient. The `,` was the real issue so unifying shift down with command down is what you want -- the curly brackets work well. – l'L'l Dec 29 '15 at 20:04