2016-11-10 78 views
0

我嘗試做一個腳本來設置一個變量(例如,設置matchornotmatch匹配),如果所有變量都相等。AppleScript如果等於,等於,等於

set value1 to "FR" 
set value2 to "FR" 
set value3 to "FR" 
set value4 to "FR" 

set matchornotmatch to "no match" 

if value1 is equal to (value2 is equal to (value3 is equal to value4)) then 
    set matchornomatch to "MATCH" 
end if 

如果沒有返回值1 =值2 =值3,但不等於VALUE4(如果可能)

回答

1

一系列的如果,否則,如果,else語句應該做的伎倆:

set value1 to "FR" 
set value2 to "FR" 
set value3 to "FR" 
set value4 to "FR" 

set matchornotmatch to "" 

if (value1 = value2) and (value1 = value3) then 
    if (value1 = value4) then 
     set matchornotmatch to "MATCH" 
    else 
     set matchornotmatch to "partial match" 
    end if 
else 
    set matchornotmatch to "no match" 
end if 

return matchornotmatch