AppleScript小于数字或大于数字
当我连续使用小于或大于运算符时,AppleScript中出现错误。我可能没有很好地解释,所以我将发布代码AppleScript小于数字或大于数字,applescript,Applescript,当我连续使用小于或大于运算符时,AppleScript中出现错误。我可能没有很好地解释,所以我将发布代码 **set good to false** **repeat until good = true** set oneTen to the text returned of (display dialog "Pick a number from 1 through 10" default answer "" buttons {"OK"} default button 1) as number
**set good to false**
**repeat until good = true**
set oneTen to the text returned of (display dialog "Pick a number from 1 through 10" default answer "" buttons {"OK"} default button 1) as number
if oneTen is less than 0 then
display dialog "below" buttons {""} default button 1
else if oneTen is greater than 10 then
display dialog "above" buttons {""} default button 1
else
set good to true
end if
**end repeat**
我试图从提示中获取输入,并防止用户输入任何低于0或高于10的内容。你能发布一些代码来做好这件事吗
我想要类似的东西
**set oneTen to the text returned of (display dialog "Pick a number from 1 through 10" default answer "" buttons {"OK"} default button 1) as number**
**if oneTen is less than 0 or greater than 10 then**
**-- make them do the prompt again**
**end if**
尝试:
我忘了说。谢谢这正是我想要的!我甚至可以添加到它,这样我就可以扩展我的代码。谢谢另外,感谢您的快速回复!
repeat
set oneTen to the text returned of (display dialog "Pick a number from 1 through 10" default answer "" buttons {"OK"} default button 1) as number
if oneTen is less than 0 then
display dialog "below" buttons {""} default button 1
else if oneTen is greater than 10 then
display dialog "above" buttons {""} default button 1
else
exit repeat
end if
end repeat