Jump to content

AppleScript workflows failing [Fixed 2.2 b239]


timcnicholls

Recommended Posts

I recently upgraded to Mavericks and am experiencing problems with Applescript-based workflows that were working fine previously. In attempting to debug the workflows, it seems that even basic RunNSAppleScript actions fail for scripts that work just fine in Script Editor.

 

For instance, I tried a toy Keyword to Applescript workflow, with or without keyword arguments:

on alfred_script(q)
   tell application “iTerm”
      activate
   end tell
end alfred_script

fails with the following output in Console:

13/12/2013 11:37:25.761 Alfred 2[381]: [ERROR] AppleScript Error: {
    NSAppleScriptErrorBriefMessage = "Expected expression, property or key form, etc. but found unknown token.";
    NSAppleScriptErrorMessage = "Expected expression, property or key form, etc. but found unknown token.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {38, 1}";
}

Other workflows, e.g. passing calendar sentences to Fantastical, continue to work fine.

 

I'm running Alfred v2.1.1 (227) on Mac OSX Mavericks 10.9 build 13A603.

 

Any suggestions on how to investigate this further?

 

Thanks

 

Tim

 

 

Edited by timcnicholls
Link to comment
Share on other sites

 

I recently upgraded to Mavericks and am experiencing problems with Applescript-based workflows that were working fine previously. In attempting to debug the workflows, it seems that even basic RunNSAppleScript actions fail for scripts that work just fine in Script Editor.

 

For instance, I tried a toy Keyword to Applescript workflow, with or without keyword arguments:

on alfred_script(q)
   tell application “iTerm”
      activate
   end tell
end alfred_script

fails with the following output in Console:

13/12/2013 11:37:25.761 Alfred 2[381]: [ERROR] AppleScript Error: {
    NSAppleScriptErrorBriefMessage = "Expected expression, property or key form, etc. but found unknown token.";
    NSAppleScriptErrorMessage = "Expected expression, property or key form, etc. but found unknown token.";
    NSAppleScriptErrorNumber = "-2741";
    NSAppleScriptErrorRange = "NSRange: {38, 1}";
}

Other workflows, e.g. passing calendar sentences to Fantastical, continue to work fine.

 

I'm running Alfred v2.1.1 (227) on Mac OSX Mavericks 10.9 build 13A603.

 

Any suggestions on how to investigate this further?

 

Thanks

 

Tim

 

 

 

Hi Tim,

 

It looks like Mavericks "Smart Quotes" is changing the quotation marks to unicode quotes instead of the straight up quotes. I had turned this auto substitution off automatically in almost every other place, but it looks like Alfred's AppleScript editor was overlooked.

 

I'll get this fixed in the next release, but for now, if you right click in the text area where the AppleScript is being edited, select 'substitutions' and turn off "Smart Quotes", then you'll be able to get the AppleScript working with "iTerm".

 

Cheers,

Andrew

Link to comment
Share on other sites

Hi Andrew

 

Great - that's fixed the problem, and the more complex scripts (e.g for creating Evernote notes) are now working again too having fixed the smart quote mangling. I also noticed it was substituting dashes in commented out lines of scripts.

 

Thanks for the quick response.

 

Cheers

 

Tim

Link to comment
Share on other sites

  • 3 weeks later...

Just adding my 2 cents that I ran into the same issue.  And just to be clear and complete, indeed you must:

  1. turn off "smart quotes" from the right-click context menu for each impacted script
  2. re-do the quotes ("") anywhere in the script where smart quotes have been substituted 

Thanks for fixing!

Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...