reading user defaults from a non-AS Studio script

I’m working on a AS Studio application that writes user defaults using the standard method.

It then runs an embedded script, after writing the user defaults.

I expected that that script could read the defaults, but not exactly:

set r to contents of (do shell script “defaults read com.wbc.castaway actionplists”)

What I expected was a list
{“*bbq”,“Podcasts”}

but the result is:
“("*bbq", Podcasts)”

Coercing to a list doesn’t help:

set r to contents of (do shell script “defaults read com.wbc.castaway actionplists”) as list

result:
{“("*bbq", Podcasts)”}

Any idea how to use the same user defaults method that AS Studo uses to read these files in a normal apple script?

Thanks

EDIT:

I’m able to do this apparently in the following way. However, this launches the application. I want to be able to read those defaults WITHOUT having to open the application – or else it defeats the purpose.

tell application “Cast Away”
tell user defaults
set actionplists to contents of default entry “actionplists” as list
end tell
end tell

result:
{“*bbq”, “Podcasts”}

The “defaults” tool and the “user defaults” feature of AS Studio are not the same. The “user defaults” feature automatically bridges textual values of a plist to the AppleScript equivalents (strings, integers, floats (reals), dates, lists (arrays), and records (dicts)) while the “defaults” tool has no idea about AppleScript classes. There maybe a way to use “user defaults” to read another plist based on the bundle ID but I don’t know how to do that. However, I’ve posted some routines for using the “defaults” tool to read a plist and coerce the values (somewhat) to AppleScript values. See http://bbs.applescript.net/viewtopic.php?id=13390.

Jon

Jonn, thanks you rock for your help. But I don’t want to spend all that time coercing like that.

there’s got to be a way to use a call method to read a plist file created by an AS studio app.

Note that the double tell method in my edit does work. (I’ll probably, sadly, end up resorting to that.)

However, maybe some other open application could be tricked into using it’s user defaults tell block to read another app’s plist file.

Don’t really know… groping in the dark here.