Re: Trouble implementing selection property


Steve Mills
 

It turns out that if you dink around enough, sooner or later things just work right. Maybe AppleScript was keeping a cached version of my dict in memory or something, but I quit Script Debugger and cleaned & built my app many times. Then suddenly it worked.

But now I'm getting this problem. Returning some objects to a script shows them as the wrong class. Like here's the AppleEvent when I request "keyword 1 of document 1":

<NSAppleEventDescriptor: 'core'\'getd'{ '----':'obj '{ 'form':'indx', 'want':'Keyw', 'seld':1, 'from':'obj '{ 'form':'indx', 'want':'docu', 'seld':1, 'from':null() } }, &'csig':65536 }>

Looks good. Now here's the object specifier as seen in my app's log when I have NSScriptingDebugLogLevel set to 1:

Result: <NSAppleEventDescriptor: 'obj '{ 'from':'obj '{ 'from':null(), 'want':'docu', 'form':'name', 'seld':'utxt'("_Untitled") }, 'want':', 'form':'name', 'seld':'utxt'(" test picts 2") }>

Notice the malformed value for the 2nd 'want'. It should be 'want':'Keyw', but it's 'want':'

Looking at the returned object in Script Debugger shows the same thing when I view as AEPrint:

'obj '{ 'form':'name', 'want':', 'seld':'utxt'(" test picts 2"), 'from':'obj '{ 'form':'name', 'want':'docu', 'seld':'utxt'("_Untitled"), 'from':[0x0,104003f "Image Chest"] } }

And viewed as Best shows:

asset "test picts 2" of document "_Untitled"

The class should be "keyword" not "asset". Why is AppleScript being annoying?

--
Steve Mills
Drummer, Mac geek

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.