Re: Searching for the equivalent of coercing to type "record"
Re: Searching for the equivalent of coercing to type "record"
- Subject: Re: Searching for the equivalent of coercing to type "record"
- From: has <email@hidden>
- Date: Fri, 7 Mar 2003 16:38:40 +0000
Steve Cunningham wrote:
I have a tab-seperated text file of the form:
[...]
I know the set of possible field names, but not which will appear in any
given record or in what sequence
What I'd like to end up with is an AppleScript record of the form:
{field_name_x: "field value",field_name_y: "field value"}
[...]
Unfortunately the construct
{"field_name_x", "field value","field_name_y", "field value"} as record
doesn't exist as far as I can tell.
Does anyone have any suggestions for achieving the equivalent?
You haven't indicated what you plan to do with it, so I dunno what
the most appropriate suggestions will be. But anyway...
Does it have to be a record? Or will any key-value based structure do?
If the former, search the list archives for posts by Olof Hellman, or
look for 'HashLib' on ScriptBuilders (www.macscripter.net); those're
hacky methods and there's a bit of a performance penalty in the
conversion. Or, if you're on OS9, look for the RecordAccess osax on
www.osaxen.com (I'm not sure how that handles, but probably faster
than the other options).
Otherwise, if all you need is a convenient structure for looking up
values by a key, go to my website for a associative array library.
Should be fast enough for most tasks.
HTH
has
--
http://www.barple.pwp.blueyonder.co.uk -- The Little Page of AppleScripts
_______________________________________________
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.