• 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: Getting Multiple Returns From A Dialog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting Multiple Returns From A Dialog


  • Subject: Re: Getting Multiple Returns From A Dialog
  • From: Christopher Nebel <email@hidden>
  • Date: Tue, 11 Mar 2003 20:30:49 -0800

On Tuesday, March 11, 2003, at 06:10 PM, Marc K. Myers wrote:

How would one go about getting multiple results from a dialog with
three buttons and a text entry box? I want to store the button
returned in a variable and the text returned in a variable.

display dialog "TEXT" default answer "42" buttons {"one","two","three"}
set text1 to --text returned of the dialog
set button1 to --button returned of the dialog

To do it all in one line:

set {text1, button1} to (display dialog "Text" default answer "42" buttons {"one", "two", "three"}) as list

Do not do this. Items in a record are not guaranteed to be in any particular order, so this script is extremely vulnerable to changes in the system. Here's a reliable way:

set {t, b} to {text returned, button returned} of (display dialog "Text" default answer "42" buttons {"one", "two", "three"})


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Getting Multiple Returns From A Dialog (From: "Marc K. Myers" <email@hidden>)

  • Prev by Date: Re: a secure delete droplet
  • Next by Date: Re: birth date from Address Book
  • Previous by thread: Re: Getting Multiple Returns From A Dialog
  • Next by thread: Re: System Events problem
  • Index(es):
    • Date
    • Thread