Re: Coerce string to record or something like that?
Re: Coerce string to record or something like that?
- Subject: Re: Coerce string to record or something like that?
- From: JJ <email@hidden>
- Date: Wed, 12 Dec 2001 22:16:15 +0100
>
There are. The simplest way to go from "{status: /"unproc/",lyrics: false}"
>
to {status: "unproc",lyrics: false} is to use Standard Additions' "run
>
script" to compile the string, i.e. run script "{status: /"unproc/",lyrics:
>
false}". It's slow, mind you; decent script editors may have a command that
>
does the same thing much quicker, e.g. in Smile, use "do script". To go the
>
other way, you need to pull a big ol' dirty trick on AS: Peter Lee and
>
Richard 23 came up with a handler called coerceToString() that can coerce
>
most anything to string, including records. It's on R23's website; you can
>
probably find the address on macscripter.net's link page.
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}
JJ
** Running AppleScript 1.3.7