• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: working with records
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: working with records


  • Subject: Re: working with records
  • From: Philip Aker <email@hidden>
  • Date: Tue, 21 Aug 2007 13:36:35 -0700

On 2007-08-21, at 13:06:49, Wayne Melrose wrote:

On 21/08/2007, at 10:02 PM, Stan Cleveland wrote:

set rec to {username:"wayne", emailadd:"email@hidden", blah:7}
set {username, emailadd, blah} to {username, emailadd, blah} of rec
username --> "wayne"
emailadd --> "email@hidden"
blah --> 7

that's not bad at all :) 

Further to that question and to try and simplify your already good suggestion.. 

we can get the items of the rec variable by using 

get items of rec 
--result  -> {"wayne", "email@hidden", 7}

set reco to {username:"wayne", emailadd:"email@hidden", blah:7}
reco as list

can we get the labels the same way? 

No, unless you want to use an ugly hack which has some prerequisites. Basically you have to snag the error string and parse it for the labels:

try
reco as text
on error errs number errn
return errs
end try
-->"Can't make {username:\"wayne\", emailadd:\"email@hidden\", blah:7} into type string."

However there is a helper OSAX available: <http://www.latenightsw.com/freeware/RecordTools/index.html>.

Philip Aker
email@hidden


 _______________________________________________
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

  • Follow-Ups:
    • Re: working with records
      • From: Wayne Melrose <email@hidden>
References: 
 >Re: working with records (From: Stan Cleveland <email@hidden>)
 >Re: working with records (From: Wayne Melrose <email@hidden>)

  • Prev by Date: Re: working with records
  • Next by Date: Re: using rsync
  • Previous by thread: Re: working with records
  • Next by thread: Re: working with records
  • Index(es):
    • Date
    • Thread