好的,我想查看“用户”是否输入了10以上的数字,但我不知道该把它放在哪里或怎么做。
set volume 10
say "Hello and Welcome to Tyler's Spam Bot"
set amount to text returned of (display dialog "How many times?" default answer "More than 10")
repeat amount times
tell application "Finder" to make new Finder window
if amount comes before 10 then
return true
else
return false
end if
end repeat
答案 0 :(得分:0)
使用try / on错误块检查是否可以将值转换为整数。如果可以,继续,并询问该数字是否大于10;如果是这样,请执行您的操作。
set received_integer to "False"
repeat while received_integer is not "True"
set amount to text returned of (display dialog "How many times?" default answer "More than 10")
try
set amt_as_int to amount as integer
if amt_as_int ≥ 10 then
set received_integer to "True"
repeat amt_as_int times
tell application "Finder" to make new Finder window
end repeat
end if
end try
end repeat