Syntax error on applescript

I am trying to make this app:


display dialog "Open Which Application" buttons {"Chrome", "AppleScript", "Textedit"}

set the button_pressed to the button returned of the result

if the button_pressed is "Chrome" then

Open application "Google Chrome"-- action for 1st button goes here

if the button_pressed is "Applescript" then

Open application "Applescript Editor"-- action for 2nd button goes here

if the button_pressed is "Textedit" then

Open application "Textedit"-- action for 3rd button goes here

end


But it keeps saying SYNTAX ERROR: expected else ect but found end of script/line


What do I do????

Posted on Mar 1, 2013 3:24 PM

Reply
2 replies

Mar 1, 2013 5:48 PM in response to Mac Maker227

Hi,


In your 'if' block conditional syntax subsiquent options should be formatted as 'else if':


display dialog "Open Which Application" buttons {"Chrome", "AppleScript", "Textedit"}

set the button_pressed to the button returned of the result

if the button_pressed is "Chrome" then


openapplication "Google Chrome" -- action for 1st button goes here

else if the button_pressed is "Applescript" then


openapplication "AppleScript Editor" -- action for 2nd button goes here

else if the button_pressed is "Textedit" then


openapplication "TextEdit" -- action for 3rd button goes here

end if


Best wishes

John M

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.

Syntax error on applescript

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