• 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: Password-Dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Password-Dialog


  • Subject: Re: Password-Dialog
  • From: Christopher Nebel <email@hidden>
  • Date: Thu, 3 Nov 2005 21:07:52 -0800

On Nov 3, 2005, at 12:26 PM, Thomas Vatter wrote:

I try to find out if user has pressed the cancel-button in the password-dialog that is shown automatically. I need this to cancel the installation process.

Ah yes, you were asking about this a few days ago. You didn't say, but it sounds like you're talking about the authentication dialog from "do shell script with administrator privileges". If the user presses "cancel", the command will throw an error, which you can catch using a "try" block like this:


    try
        do shell script "..." with administrator privileges
    on error e number n
        -- n is -128, e is "User canceled."
    end

Most other dialog commands in AppleScript work this way, including "display dialog" -- if you have a button named "Cancel" (or the localized equivalent for your language), pressing it will generate the same error. ("choose from list" is an exception for historical reasons.)


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Password-Dialog (From: Thomas Vatter <email@hidden>)

  • Prev by Date: Re: Specific Date-Time Formatting
  • Next by Date: Re: Specific Date-Time Formatting
  • Previous by thread: Password-Dialog
  • Next by thread: Re: Password-Dialog
  • Index(es):
    • Date
    • Thread