Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: get the properties of a record (Academic Question)



On 08-05-13, at 04:07, Philip Buckley wrote:

Hmmm, The short answer is probably "no, not really ... but ..."

The "but" part being if you want to do it with pure AppleScript you have to induce an error and then parse the error string. The parsing gets uglier and uglier depending on the nature of the keys and values. For instance, if you try to split the string using delimiter ":" you'll get blown away by the first date string. Similarly for a comma delimiter.

try
set reco to {date:current date, name:"Bob Smith", |betting on|:"Obama", amount:1000.0}
reco as text
on error errs
set ti to text items of errs
set rcount to count of ti
set sbrace to (offset of "{" in errs) + 1
set ebrace to rcount - (offset of "}" in ((reverse of ti) as text))
set tstr to (text items sbrace thru ebrace of errs) as text
return tstr
end try

--> "date:date \"Tuesday, May 13, 2008 8:07:19 PM\", name:\"Bob Smith\", |betting on|:\"Obama\", amount:1000.0"


Philip Aker
echo email@hidden@nl | tr a-z@. p-za-o.@

Sent from my SE/30

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Studio mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-studio/email@hidden

This email sent to email@hidden

References: 
 >get the properties of a record (Academic Question) (From: Gil Dawson <email@hidden>)
 >Re: get the properties of a record (Academic Question) (From: Philip Buckley <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.