Applescript的"从列表中选择"用户交互有一个"取消"按钮 - 我希望这个"取消"告诉脚本立即停止执行.换一种说法:
set wmColor to choose from list {"Black", "Black for all", "White",
"White for all"} with prompt "What color should the watermark be?"
default items "White for all" without multiple selections allowed and
empty selection allowed
if wmColor is false
*tell script to stop executing*
end if
Run Code Online (Sandbox Code Playgroud)
似乎无法找到如何做到这一点 - 有谁知道如何?
小智 30
错误号-128是"用户已取消",并将停止脚本 - 例如:
if wmColor is false then
error number -128
end if
Run Code Online (Sandbox Code Playgroud)
小智 11
"return"告诉脚本停止执行:
display dialog "Do you want to exit this script?" with icon note buttons {"Exit", "Continue"}
if the button returned of the result is "Exit" then
return
end if
Run Code Online (Sandbox Code Playgroud)