• 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: Paul Berkowitz <email@hidden>
  • Date: Sun, 14 Jul 2002 20:36:24 -0700

On 7/14/02 7:08 PM, "cricket" <email@hidden> wrote:

> On Sunday, July 14, 2002, at 06:43 PM, Dave DeLong wrote:
>
>> I have a problem (this sounds kinda stupid) with the "choose from
>> list" option of AppleScript. If I have a script:
>>
>> choose from list {myList} with prompt myPrompt
>> set myChoice to the result
>
> The return value from 'choose from list' will be a list, so your check
> for whether myChoice is "Books" will always fail. If "Books" is the
> only chosen item from myList, myChoice will be {"Books"}
>
> So, what you need for the second part is something more like:
>
> if myChoice contains "Books" then
> choose from list {myList2} with prompt myPrompt2
> end if
>
>> if myChoice is "Books" then --for example
>> choose from list {myList2} with prompt myPrompt2
>> end if
>>
>> the second choose from list will not work. Help?
>
> - cricket

But since that would give a positive even where multiple selection is
allowed, it's better to change the first part instead.

Furthermore, it's still going to fail. There are two more errors.

If myList is indeed a list, it will be something like

set myList to {"Books", "Basketballs", "Violins"}

It will _already_ be in list brackets. So

choose from list {myList}

will actually be

choose from list {{"Books", "Basketballs", "Violins"}}

That will give the inevitable error "Can't make some data into the expected
type."

Same thing in the 'second choose from list {myList2}' with your suggested
solution. Get rid of those second set of list brackets!

So what he really wants is:


choose from list myList with prompt myPrompt

set myChoice to the result as string -- or 'item 1 of theResult'

if myChoice is "Books" then --for example
choose from list myList2 with prompt myPrompt2
set myChoice to the result as string
end if

--
Paul Berkowitz
_______________________________________________
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: "choose from list" (From: cricket <email@hidden>)

  • Prev by Date: Re: url access
  • Next by Date: Re: Unquoting a string
  • Previous by thread: Re: "choose from list"
  • Next by thread: has's list wrappers [Re: Passing *possible* variables to a handler]
  • Index(es):
    • Date
    • Thread