Skip navigation

Syntax error on applescript

459 Views 2 Replies Latest reply: Mar 2, 2013 5:46 AM by HD RSS
Mac Maker227 Calculating status...
Currently Being Moderated
Mar 1, 2013 3:24 PM

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????

  • John Maisey Level 5 Level 5 (6,880 points)
    Currently Being Moderated
    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

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

    else if the button_pressed is "Applescript" then

      open application "AppleScript Editor" -- action for 2nd button goes here

    else if the button_pressed is "Textedit" then

      open application "TextEdit" -- action for 3rd button goes here

    end if

     

    Best wishes

    John M

  • HD Level 4 Level 4 (3,240 points)
    Currently Being Moderated
    Mar 2, 2013 5:46 AM (in response to Mac Maker227)

    "open application" won't work either, as far as I'm aware. The syntax is

     

    tell application "Google Chrome" to activate

Actions

More Like This

  • Retrieving data ...

Bookmarked By (0)

Legend

  • This solved my question - 10 points
  • This helped me - 5 points
This site contains user submitted content, comments and opinions and is for informational purposes only. Apple disclaims any and all liability for the acts, omissions and conduct of any third parties in connection with or related to your use of the site. All postings and use of the content on this site are subject to the Apple Support Communities Terms of Use.