Re: names of a record's items
Re: names of a record's items
- Subject: Re: names of a record's items
- From: "Stockly, Ed" <email@hidden>
- Date: Wed, 09 Apr 2014 18:21:25 +0000
- Thread-topic: names of a record's items
Speaking of "elaborate attemtps to work around this problem", there's this:
set aRecord to system info
GetRecordLabels(aRecord)
on GetRecordLabels(thisRecord)
try
get thisRecord as text
on error errText
set recordText to errText
log errText
end try
set AppleScript's text item delimiters to ":\""
set labelParsingText to every text item of recordText
set AppleScript's text item delimiters to return
set labelParsingText to labelParsingText as string
set AppleScript's text item delimiters to "Can't make {"
set labelParsingText to text item 2 of labelParsingText
set AppleScript's text item delimiters to ","
set recordLabels to {}
set labelParsingText to paragraphs of labelParsingText
set labelParsingText to the reverse of rest of reverse of
labelParsingText
repeat with thisLabel in labelParsingText
set the end of recordLabels to the last text item of thisLabel as
text
end repeat
return recordLabels
end GetRecordLabels
Doesn't do so well with some record values (aliases, for example, but where
I needed it the values were all strings or lists of strings.
On 4/9/14 9:48 a.m., "Ed Stockly" <email@hidden> wrote:
>
>> Can you coerce this to a string,
>
> Nope. Not possible.
>
>
> Not directly. I believe that one of the cumbersome workarounds was to
> convert it to a script, then convert the script to text.
>
> I'll see if I can find the script I did this with in Mac OS9. It was a
> printing script for Quark and the issue was that various print drivers would
> use different record labels for the same values, and that had to be resolved
> at runtime.
>
> Also, I Mark's List & Record Tools Osax at Late Night Software could do this
> as well.
>
> --get user property names {myAge:42} --> {"myAge"}
>
> List & Record Tools | Late Night Software
> http://www.latenightsw.com/freeware/list-record-tools/
>
> HTH
>
> Ed
>
_______________________________________________
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