AppleScript:多重条件

时间:2016-11-08 16:15:46

标签: variables applescript conditional-statements

我需要多个条件才能运行我的脚本

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

这不行,我想AppleScript不允许这样做。

我当时正在考虑做这样的事情:

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

这有什么比这更简单了吗?

1 个答案:

答案 0 :(得分:1)

您在var2

之后错过了=
if var1 = "variable 1 is here" and var2 = "variable 2 is here" then