KevinCork KevinCork - 29 days ago 15
AppleScript Question

AppleScript : multiple condition

I need multiple condition to be true to run my script

set var1 to "variable 1 is here"
set var2 to "variable 2 is here"


if var1 = "variable 1 is here" and var2 "variable 2 is here" then
set var1 to "true"
end if


This is not working though, I guess AppleScript don't allow this.

I was thinking then to do something like this :

set score to 0
set var1 to "variable 1 is here"
set var2 to "variable 2 is here"

if var1 = "variable 1 is here" then
set score to score + 1
end if

if var2 = "variable 2 is here" then
set score to score + 1
end if

if score = 2 then
...


Is there anything simpler that this?

Answer

Your missing the = after the var2

if var1 = "variable 1 is here" and var2 = "variable 2 is here" then