• 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: Picking data from a record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Picking data from a record


  • Subject: Re: Picking data from a record
  • From: has <email@hidden>
  • Date: Sat, 25 Sep 2004 00:56:44 +0100

Joseph Weaks wrote:

There is no dynamic hash array built into appplescript; that's the
problem.

The Types library at AppleMods <http://applemods.sourceforge.net/mods/Data/Types.php> provides 'Dict' objects as a vanilla alternative. Example:

    -- [auto-generated library loading code goes here]

    -- make a new Dict object
    set d to _Types's makeDict()

    -- add values to dict
    d's setItem("foo", 1)
    d's setItem("bar", true)

    -- count no. of items in dict
    log d's countItems() --> 2

    -- get values from dict
    log d's getItem("foo") --> 1
    log d's getItem("fub") -- Error: "Can't getItem: key not found."


Not as fast or efficient as a native hash type would be (but if you need better types then use Perl or Python or something), but good enough for light to moderate use.


HTH

has

p.s. If you've not used AppleMods' libraries before, you'll need to download and install the library Loader first: <http://applemods.sourceforge.net/getstarted.html>. Once that's done, drop the Types library into the ASLibraries folder and use the LoaderWizard applet to generate library loading code to add to your script.
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
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
  • Prev by Date: Re: Make New Window in Terminal...
  • Next by Date: Re: Make New Window in Terminal...
  • Previous by thread: Re: Picking data from a record
  • Next by thread: Re: Picking data from a record
  • Index(es):
    • Date
    • Thread