Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. osascript -e 'tell application id "com.apple.systemevents"'
  4. -e 'display dialog "Do you want to continue?" & return & return &
  5. " Please wait..." buttons {"Cancel", "Okay"} default button
  6. 2 cancel button "Cancel"' -e 'end tell' -e 'if button returned is "Cancel" then'
  7. -e '<blah blah kill this script>' -e 'end if'
  8.  
  9. -- other bash stuff here
  10.  
  11. #!/bin/bash
  12.  
  13. osascript >/dev/null 2>&1 <<-EOF
  14. tell application id "com.apple.systemevents"
  15. set myMsg to "Do you want to continue?" & return & return & " Please wait..."
  16. set theResp to display dialog myMsg buttons {"Cancel", "Okay"} default button 2
  17. end tell
  18.  
  19. # Following is not really necessary. Cancel returns 1 and OK 0 ...
  20. if button returned of theResp is "Cancel" then
  21. return 1
  22. end if
  23. EOF
  24.  
  25. # Check status of osascript
  26. if [ "$?" != "0" ] ; then
  27. echo "User aborted. Exiting..."
  28. exit 1
  29. fi
  30.  
  31. #-- other bash stuff here
  32. echo "All good, moving on...."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement