SHELL/AppleScript:在 "Cancel" 停止 AppleScript 并退出 Shell
SHELL/AppleScript: On "Cancel" stop AppleScript and Quit Shell
我只是想在用户点击 "Cancel" 按钮后 stop/exit 脚本。
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if'
尽管它继续执行剩余的 Shell 脚本。我也尝试过 do shell script "exit"
、return
并以各种方式重新定义取消按钮。
任何建议将不胜感激
这应该是必需的:
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if' || exit
我只是想在用户点击 "Cancel" 按钮后 stop/exit 脚本。
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if'
尽管它继续执行剩余的 Shell 脚本。我也尝试过 do shell script "exit"
、return
并以各种方式重新定义取消按钮。
任何建议将不胜感激
这应该是必需的:
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if' || exit