I am simply trying to stop/exit the script after the user hits "Cancel" butoon.
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'
Although it continues executing the remaining Shell script. I have also tried do shell script "exit"
, return
and redefining the cancel button in various ways.
Any advice would be much appreciated
This should be what's required :
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
That was it! I feel ashamed, that I didn't know I could combine
&& ||
withosascript
! Many thanks!