Forcing property lists into unicode text

Hello!

While trying to get some raw text output in xcode, I’m getting raw myself. For example

set contents of text field 1 of window 1 to properties of me

always gets me an error, saying it can’t be converted to unicode text. How can I get arround this?

TIA

Hi,

a text field expects a value of class text, but properties are usually records, which can’t be coerced to text

You can cheat a bit with this old hack:

set myRec to {A:"Foo", B:"Bar"}
try
	myRec as string -- will always fail, as Stefan points out.
on error e
	set tError to e
	set O1 to offset of "{" in tError
	set O2 to offset of "}" in tError
	set tE to text O1 thru O2 of tError
end try

Thanks Stefan. Thanks Adam: The error handler hack is neat. Works great.

Warning, though, awado;

Since it is a hack, it’s not guaranteed to work across revisions of AppleScript. Having said that, Nigel Garvey told me that it has worked since back in Classic days when it was first introduced by Arthur Knapp.