• 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: Coercion of string to a record label
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercion of string to a record label


  • Subject: Re: Coercion of string to a record label
  • From: Bryan <email@hidden>
  • Date: Wed, 10 Oct 2001 04:40:25 -0400
  • Organization: Apex Radiology

the following uses the "MakeValueText" command of the PrefIO OSAX (Steve LoBasso)
alternatively, you may be able to use the "Coerce Record to Text" OSAX fro LNS for this.
----------------------------------------
on theprop(theproperty, theRecord)
run script "return " & theproperty & " of " & (MakeValueText theRecord)
end theprop

set myrecord to {a:1, b:"2"}
set myproperty to "a"
theprop(myproperty, myrecord)
-----------------------------------------

Bryan Kaufman


Harald E Brandt wrote:

> +--> Olof Hellman wrote 01-10-09:
> >Ah, my favorite topic. From a suggestion of mine, cleaned up by Emmanuel:
> >
> >to usrf(theList)
> > script
> > {+class usrf;:theList}
> > end script
> > run script the result
> >end usrf
> >
> >usrf({"a", 1, "b", 2})
> >
> >--> {a:1, b:2}
> +-
>
> So I can make a record of a list.
> But the task was to get the property value from a record, based on a property label given as a string. I don't really see how that can easily be done using the above method - although I might be blind.
>
> I *do*, however, see how the above can be used to set a single property, although I really think it is inelegant (since it is a concatenation):
>
> set myRecord to {EU:"123", US:"789"}
> set aRegion to "eu" --got to be lower case
> set myRecord to usrf({aRegion, "99"}) & myRecord
> -->{EU:"99", US:"789"}
>
> ______heb________________________________________________________________
> Harald E Brandt email@hidden PGP/MIME aware http://heb.bragit.com
> _______________________________________________
> applescript-users mailing list
> email@hidden
> http://www.lists.apple.com/mailman/listinfo/applescript-users

[demime 0.98b removed an attachment of type text/x-vcard which had a name of bryan.vcf]


References: 
 >Coercion of string to a record label (From: Olof Hellman <email@hidden>)
 >Re: Coercion of string to a record label (From: Harald E Brandt <email@hidden>)

  • Prev by Date: Working with a text selection in Quark
  • Next by Date: AppleScript broken :(
  • Previous by thread: Re: Coercion of string to a record label
  • Next by thread: Facespan and Printing Postscript in Quark
  • Index(es):
    • Date
    • Thread