On 22/08/2007, at 11:16 PM, Christopher Nebel wrote: On Aug 21, 2007, at 4:51 AM, Wayne Melrose wrote:
I have a record with different values..
eg
set rec to {username:"wayne", emailadd:"email@hidden"}
now I can get ..
set username to username of rec set emailadd to emailadd of rec
that's fine.. but with many items in the record, what I'd like to do is extract (or expand) all of the items at the same time.. with their label coming the variable name.. is this even possible?
result would be..
set username to "wayne" set emailadd to "email@hidden"
One wonders what the actual problem you're trying to solve is. Assuming you can perform this operation, what are you going to do with all of the variables, whose names, by definition, you do not know ahead of time?
--Chris Nebel AppleScript Engineering
y'know, I thought it must have looked a little strange.. :) By definition you would not know ahead of time, in this case I do..
The history is this..
I have a record that is full of records
ie
I then have to loop through each of those records inside of mainrec
I then expand the record using annoying if statments set username to username of rec if username is "wayne" then set emailadd to emailadd of rec -- get other variables here end if
now I have to also deal with empty values.. (values are of course, not name and email address)
Point being, I'm expanding every record of main rec anyway, and each time it's the same thing, and it's alot of code.. which seems pointless if there was an easy way to expand into variables for each record on each loop.
Does that clear it up or am I starting to sound like a crazy man?
Thanks
Wayne |