我有一个用 Applescript 编写的应用程序,其中会弹出一个带有三个按钮的对话框:{帮助、添加、减去}。当用户点击“帮助”按钮时,会弹出一个对话框,显示有关应用程序的信息。此对话框将有一个 {取消、继续} 按钮。当用户点击“继续”按钮时,他应该返回到上一个对话框(带有三个按钮的对话框:{帮助、添加、减去})。但我无法让它工作。这是我的代码:
set question to display dialog "I want to" buttons {"Help", "Add", "Subtract"} default button 2
set response to button returned of question
if response is equal to "Help" then
Help()
end if
ere is my Help Function
on Help()
display dialog "blah blah" buttons {"Cancel", "Continue"}
return
end Help
如何使用带有三个按钮的对话框恢复执行?
答案1
你可以“回去再做一次”repeat
环形:
repeat
⋮
set response to …
if response is equal to "Help" then
Help()
else
exit repeat
end if
end repeat
或者repeat while
:
set response to "Help" -- just the inital condition
repeat while response is equal to "Help"
⋮
set response to …
if response is equal to "Help" then
Help()
else
end repeat