Class Coercion, Text Encoding, Apple Events, and 'unscriptable' apps!

So, this is probably a bit of a weird one, I expect. I’m basically trying to script an application that has no dictionary - by using some terminal environment variables and the OSX Console, I was able to watch the apple events that another application sends, and am trying to emulate that.

The problem I’m having is twofold - for one, the ‘small integer’ or short class seems to be converted to an integer/long at compile or runtime, not sure which. For another, no matter what I do, I can’t get a string to output with the type of ‘TEXT’ - it’s always output as ‘utxt’ (Unicode, I assume). I’ve tried using the «class utf8» trick but that doesn’t seem to work.

Here’s what I’m trying to emulate, as output by the console (kind of long!):

And here’s what my script outputs, according to the console:

Here’s the script:

set getname to display dialog "Enter a region name" default answer "HERPADERPA" as «class utf8»
set regionname to text returned of getname as «class utf8»
set filelocation to choose file with prompt "Select File"
set ffrmvar to 0 as small integer
set trakvar to -1 as small integer
set recovar to {«class Name»:regionname}

tell application "Pro Tools LE"
	«event Sd2aORgn» given «class FILE»:filelocation, «class Trak»:trakvar, «class FFrm»:ffrmvar, «class SMSt»:0, «class Rgn »:recovar
end tell


You’ll note the differences in the classes of the bolded sets of text (my script is outputting ‘long’ instead of ‘shor’ and ‘utxt’ instead of ‘TEXT’). Is there any way to get around this? Or should I look into OSA Javascript or Ruby or Python or what have you? Any help would be greatly appreciated!

Model: Mac Pro 8 core
AppleScript: 2.3
Browser: Safari 533.18.5
Operating System: Mac OS X (10.6)