Multiple Criteria for If statement in AppleScript

applescript

Solution

The correct way to chain `if` conditions in AppleScript is to repeat the full conditional:

if folder of theMsg is "A" or folder of theMsg is "B" or folder of theMsg is "C" then

– there is no implicit repetition of the left hand argument. A more elegant way to do this is to compare your left hand argument to a list of items:

if folder of theMsg is in {"A", "B", "C"} then

which has the same effect (note this relies on the implicit coercion of text to list, which, depending on your `tell` context, may fail. In that case, explicitly coerce your left, i.e. `(folder of theMsg as list)`).

Problem

I'm attempting to modify an `applescript` that fires a growl notification when there is a new message in Outlook. The original script is here. In my `if` statement, I am trying to say that if the folder is either Deleted Items, Junk E-mail or Sent Items, don't fire the notification. Here is the statement: ``` if folder of theMsg is "Junk E-mail" or "Deleted Items" or "Sent Items" then set notify to false else set notify to true end if ``` It appear that applescript does not like the multiple is/or items I've added. Is there a way to include the multiple criteria, or do I need to write a nested if/then?

Original source