• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
if-else statements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

if-else statements


  • Subject: if-else statements
  • From: iKel via AppleScript-Users <email@hidden>
  • Date: Sun, 24 Nov 2019 13:00:29 -0600

Hi everyone,
I am trying to learn how if-else statements work in AppleScript. When I run the
script below I get "Expected end of line, etc. but found “else”.” It seems like
a simple script but I get this error and just really trying to learn the
mechanics of if-else statements in AS. I appreciate the help and insight!

set the dialog_result to ¬
        (choose from list {1, 2, 3, 7} ¬
                with title ("Pick the lucky number"))
if the dialog_result is {7} then display dialog ¬
                "You win!" buttons {"OK"} default button {"OK"}
else
        set the unluckyNumber to the dialog_result
        display dialog the unluckyNumber & " is an unlucky number."
end if

Kind regards,
Kell


Logic is the foundation of the certainty of all the knowledge we acquire.
-Leonhard Euler

Kellen Ruyle
email@hidden




 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: if-else statements
      • From: Jon Pugh via AppleScript-Users <email@hidden>
    • Re: if-else statements
      • From: Steve Mills via AppleScript-Users <email@hidden>
  • Prev by Date: Re: Script editor wouldn't save a scpt file. Copied it to Tex-Edit closed Script Editor open it and pasted in text worked
  • Next by Date: Re: if-else statements
  • Previous by thread: Re: Scripting Mail signatures
  • Next by thread: Re: if-else statements
  • Index(es):
    • Date
    • Thread