Playing with NSAppleScript, I'm currently befuddled by -compileAndReturnError returning the following:
NSAppleScriptErrorNumber = -1700;
NSAppleScript.h has no error codes listed, and a search (so far) has turned nothing up.
Actually, about half the time, the particular lines of code (run on the main thread of course, as required by NSAppleScript):
will actually crash the application with the stack:
#0 0x923dfd7c in getDescDataType
#1 0x923e3ad7 in aeCoerceDescInternal
#2 0x923e8075 in AECoerceDesc
#3 0x005ae150 in ComponentCoerceDesc
#4 0x00592bec in ASCompile
#5 0x9600b5bc in CallComponentFunction
#6 0x0058dae2 in AppleScriptComponent
#7 0x005a9927 in AGenericManager::HandleOSACall
#8 0x95fc5ef5 in CallComponentDispatch
#9 0x923cd513 in OSACompile
#10 0x92d84eff in -[NSAppleScript compileAndReturnError:]
#23 0x9577692e in NSApplicationMain
#24 0x00002b84 in main at main.m:13
The source with which the script has been initialised has variously been:
"tell current application to beep 2"
The opaqueness of the error message, not to mention the intermittent crash, suggests that this one is going to take some attrition to actually chase down. What fun. Watch this space...