• 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: Choose from list
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Choose from list


  • Subject: Re: Choose from list
  • From: Stephen Swift <email@hidden>
  • Date: Sun, 05 May 2002 22:45:14 -0400

At 5/5/02 8:38 PM, Paul Berkowitz (email@hidden) Wrote:

> set theList to {"Dialog Box 1", "Dialog Box 2", "Dialog Box 3", "Dialog Box
> 4"}
>
> set optionList to {"Good Morning", "Good Afternoon", "Good Evening", "Good
> Night"}
>
> set theDialog to (choose from list theList) as string
>
> set x to my UniqueIndex(theList, theDialog)
>
> display dialog (item x of optionList)
>
> on UniqueIndex(aList, anItem)
> repeat with i from 1 to (count aList)
> if anItem = item i of aList then
> return i
> end if
> end repeat
> end UniqueIndex

Thanks Paul. Much more elegant. I presume that there is no other option to
get what item number a certain value is in a list besides a repeat loop.
That would make the script even better - but I guess I'm just dreaming. :-)

Stephen Swift
email@hidden
-----------------------------------------------
AppleScript Guru - The Mac Observer
http://www.macobserver.com/tips/applescript
_______________________________________________
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.

  • Follow-Ups:
    • Re: Choose from list
      • From: Andy Wylie <email@hidden>
    • Re: Choose from list
      • From: Matthew Stuckwisch <email@hidden>
References: 
 >Re: Choose from list (From: Paul Berkowitz <email@hidden>)

  • Prev by Date: Re: Choose from list
  • Next by Date: Re: tell darwin
  • Previous by thread: Re: Choose from list
  • Next by thread: Re: Choose from list
  • Index(es):
    • Date
    • Thread