Re: OSAX to Tokenize Record Field Names from List Items ???
Re: OSAX to Tokenize Record Field Names from List Items ???
- Subject: Re: OSAX to Tokenize Record Field Names from List Items ???
- From: Luther Fuller <email@hidden>
- Date: Fri, 22 Jun 2007 19:54:45 -0500
On Jun 22, 2007, at 7:20 PM, Rick Gordon wrote:
How might one go about the process of parsing a list, for instance:
{"fSource", "PicName", "fObjStyle", "[Basic Graphics Frame]",
"fWidth", "12p6", "fHeight", "9p3"}
... and dynamically build a record, such as:
{fSource:"PicName", fObjStyle:"[Basic Graphics Frame]",
fWidth:"12p6", fHeight:"9p3"}
... without having those field names predefined.
For starters, this works ...
on run
set aList to {"recName", 5}
set scriptText to "{" & (item 1 of aList) & ":" & (item 2 of aList)
& "}"
set aRec to do script scriptText
display dialog (recName of aRec)
end run
But, it might be better to use two synchronized lists, 'nameList'
containing the record item names, and 'valuelist' containing the
associated values, then proceed like this ...
on recordFromLists(nameList, valuelist)
recLen to (count items of nameList)
if recLen ≠ (count items of valuelist) then error "unequal lists"
repeat with i from 1 to recLen
end repeat
end recordFromLists
The recordFromLists handler will need to report errors ... just in
case something's not right.
Or you could be carefulll not te mak misteeks.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden