• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Tell Me to Quit in Unix-ese...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tell Me to Quit in Unix-ese...


  • Subject: Re: Tell Me to Quit in Unix-ese...
  • From: Stan Cleveland <email@hidden>
  • Date: Mon, 06 Apr 2015 14:52:40 -0700

On Apr 6, 2015, at 2:28 PM, Stan Cleveland <email@hidden> wrote:

On Apr 6, 2015, at 1:46 PM, Oakman <email@hidden> wrote:

I want to give the user the opportunity to cancel out of the script, however I know not how to achieve that. 

Hi Oakman,

in place of this:
'<kill script>'
Put this:
'error number -128'

You can safely eliminate the following unnecessary code, as well:
cancel button "Cancel"
The "Cancel" button is by definition the default cancel button. You'd specify this only if using a different button name, like this:
cancel button "Stop"

Hi again,

My bad! Forget what I posted (above) without actually testing it.

Use this instead (all in one line, not three, of course):

osascript -e 'tell application id \"com.apple.systemevents\"' -e 'try' 
-e 'display dialog \"Do you want to continue?\" buttons {\"Cancel\", \"OK\"}' 
-e 'on error number -128' -e 'return \"aborted\"' -e 'end try' -e 'return \"continued\"' -e 'end tell'

This will not only let the user exit, but allows feedback to your script, if desired.

Stan C.

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Tell Me to Quit in Unix-ese...
      • From: email@hidden
References: 
 >Tell Me to Quit in Unix-ese... (From: Oakman <email@hidden>)
 >Re: Tell Me to Quit in Unix-ese... (From: Stan Cleveland <email@hidden>)

  • Prev by Date: Re: Tell Me to Quit in Unix-ese...
  • Next by Date: Re: Tell Me to Quit in Unix-ese...
  • Previous by thread: Re: Tell Me to Quit in Unix-ese...
  • Next by thread: Re: Tell Me to Quit in Unix-ese...
  • Index(es):
    • Date
    • Thread