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: even better coerce to record with usrf



JJ chipped in:

> Why are you compiling a record? Why not simply declare it?
>
> set entry_1 to record {+class usrf;:{"status", "unproc"}}
> set entry_2 to record {+class usrf;:{"lyrics", false}}
>
> set Entire_Record to entry_1 & entry_2
>
> -- That's >> {status:"unproc",lyrics:false}
>


which is brilliant!!! This speeds up the cycle by about half by getting
rid of one 'run script' :

to usrf(theList)
return record {+class usrf;:theList }
end usrf

to extract_record_field(theRecord, theField)
run script " on run{r}
return |"& fieldName & "| of r
end " with parameters {theRecord}
end extract_record_field

set usrfRecord to usrf( {serial number", 75757575 })
extract_record_field( usrfRecord, "serial number" )
--> 75757575


Can anyone figure out how to get rid of the other run script?

- Olof




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.