AppleScript "Syntax Error" notification without errors

Hello everyone and sorry for my bad english. I'm using OS X 10.6.2. I want to learn AppleScript, but every time when I try to run code I get notification "Syntax Error", but there isn't any error:


display dialog "Hello, world!"


Same thing with every code. What can be a problem?

iMac, Mac OS X (10.6.2), AppleScript error

Posted on Jan 5, 2015 11:52 AM

Reply
7 replies

Jan 5, 2015 12:25 PM in response to Macak99

Your script runs fine for me on 10.9, however you don't seem to be targeting any application, it's not an issue, but you can find some weirdness when you run the script in the editor vs as an Application, script or service etc.


tell application "Finder"

display dialog "Hello, world!"

end tell

Try the above, see if that works - Finder should 'come to the front', you can 'compile' the script in the editor which should help confirm the syntax is correct. Are you using AppleScript Editor?

It's worth checking you are using the correct quote types (straight lines vs curly ones), especially when pasting from the web…


Bad

“ ”

Good

" "


There are a few tutorials around, see if they can help…

http://www.instructables.com/id/Simple-Applescript-Tutorial/

Macscripter seems to be helpful too

http://macscripter.net



P.S. 10.6.2 is a very old version, 10.6.8 is the later version (more stable) use software update to get that installed, it may fix some weird bugs that cause issues like this, run Software update several times until it stops giving you more fixes.

Jan 5, 2015 7:29 PM in response to Macak99

This is your line of code cut and pasted into the script editor


User uploaded file

You can see it runs fine.


Given the information you have supplied it is very difficult to make any suggestions or give advice. The quotes in the text from your post are fine.


Here as an example I left off the trailing quote,this is what I then get

User uploaded file

You notice that the syntax error box contains information regarding the error. Perhaps it would help if you posted the full error.



regards

Oct 12, 2016 5:55 AM in response to JoeRzzlDzzl

I don't believe you are seeing the same error, this post is concerning Applescript editor on 10.6.2 & you are on a much newer OS using Automator. 'Syntax error' is a generic - u done goofed, message.


I'd start with the basic placeholder that Automator uses - do not remove the 'on run' wrapper & see if you can add a line with the dialog test…


on run {input, parameters}


(* Your script goes here *)


display dialog "Whatever"

return input

end run

Hit the 'compile hammer' to see if the syntax is OK & then run it (compiling also adds the colour to the code).


I don't have 10.11 running so I can't help beyond that. If you can't get it working I'd suggest you create a new topic as this one seems to be a different issue as far as I can see.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript "Syntax Error" notification without errors

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.