Re: ANN: String to Property Coercion subroutines released
Re: ANN: String to Property Coercion subroutines released
- Subject: Re: ANN: String to Property Coercion subroutines released
- From: has <email@hidden>
- Date: Thu, 2 Jun 2005 10:33:17 +0100
Jeff Portenwrote:
>>In addition to, or as an alternative with additional functionality, users might be interested in the 'ConvertToString' AppleScript library found at the AppleMods repository, <http://applemods.sourceforge.net/>
>
>Sight unseen, the thing my subs do that ConvertToString doesn't is allow property setting without munging strings together.
ConvertToString is a useful vanilla hack for getting the textual representation of most AppleScript values. (See the TextCommands FBA on my site for a non-hackish Unicode-savvy alternative.)
Anyway, I think what you're really looking for is a way to store and retrieve values by key, so check out AppleMods' Types library. Its Dictionary object is robust and reasonably efficient; still not a patch on a native dictionary type, of course, but good enough for most purposes. Example:
-- [auto-generated library loading code omitted for clarity]
set d to _Types's makeDict()
d's setItem("John", 31)
d's setItem("Jane", 42)
d's setItem("Jo", 23)
d's countItems() --> 3
d's getItem("Jane") --> 42
d's getKeys() --> {"Jane", "Jo", "John"}
HTH
has
--
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