Take a look to this script
set {c} to {text returned} of (display dialog "input" default answer "")
if c is "1" or "2" then -- important
display dialog "true"
else
display dialog "false"
end if
Why if the input is “2” script give me “false”?
I put “or” in the if/then, not “and”
I’m on a 10.5.3
Regards
Matteo
Model: iMac 24
AppleScript: 2.2
Browser: Camino 1.6.1
Operating System: Mac OS X (10.5)
Each element of an OR statement must itself be boolean: if c is “1” or c is “2” is the form you want.
set {c} to {text returned} of (display dialog "input" default answer "")
if c is "1" or c is "2" then -- important
display dialog "true"
else
display dialog "false"
end if
display dialog "" default answer ""
set example to text returned of result
if example is in {"1", "2"} then
display dialog "true"
else
display dialog "false"
end if
.
Nitpick: I think you’re coercing a record to a list there. One-line alternatives would include:
set c to text returned of (display dialog "input" default answer "")
set {text returned:c} to (display dialog "input" default answer "")