• 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: Timothy Bates <email@hidden>
  • Date: Thu, 21 Jul 2005 12:06:57 +1000
  • Thread-topic: Choose from list

>>> is "associative array" the new term for "record" in applescript?
> On Jul 20, 2005, at 6:37 PM, Christopher Nebel wrote:
>> No.  In a true associative array, the keys can be any value;
>> AppleScript records have to use constant keys that are known at
>> compile-time.  (For some definition of "have to" -- there are
>> tricks to get around that.)
> -- Michelle
> So Applescript doesn't have inherent associative arrays; they have to
> be explicitly written by the scripter?

They can be fudged in libraries or provided (at grat call-time expense) by
plug-ins.

With an associative array, at run time, you can take the parameters from a
web page form, and generate an associative array like

{"name"=>"tim", "OS"->"10.5.1"}

With complete flexibility over what the keys are.

Also, languages with assoc arrays (or "hash tables") allow you to access the
keys in various ways, as well as the values: so in an associative aray, the
keys are symetrical with the values for many purposes. In records, keys much
be known at compile time, can't vary, and can't be readily accessed as
values.

To make it concrete for the purpose of this email:

I might say something like

set a to Choose from list {"dog", "cat", "pet"}

And get back:
--> a = {"2", "cat"}

So I have in one place both the original index of the item(s) chosen, and
the values of the items chosen.

Tim


 _______________________________________________
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

  • Follow-Ups:
    • Re: Choose from list
      • From: "Gary (Lists)" <email@hidden>
    • Re: Choose from list
      • From: Michelle Steiner <email@hidden>
References: 
 >Re: Choose from list (From: Michelle Steiner <email@hidden>)

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