From: Adam R. M. <ama...@ma...> - 2007-03-27 17:12:44
|
On Tuesday, March 27, 2007, at 09:08AM, "Christiaan Hofman" <cmh...@gm...> wrote: >OK, first part I understand now. The first time you send an apple event to a >scripting enabled app apparently the .sdef file is loaded and intyerpreted. >This may change the way it responds to apple events, in this case the open >command was not listed for the application object, so it was ignored. That >is fixed now. However it still does not work. Now it responds to open, but >it raises an exception. Nice find. >A string object is send a count message while the >apple event is processed. The string is probably the file path, so it >expects an array. It does work when opening more than one file. Why would it >do this? It works in other apps. Overriding some methods in SKApplication shows that it's indeed getting a string instead of an array. If I replace the core suite in Skim's sdef with TextEdit's sdef (open TextEdit's dictionary, then use the proxy icon to get the file), I get a parse error, but the file opens since it doesn't go through handleOpenScriptCommand:. Preview.app doesn't have an sdef, so it's not going through handleOpenScriptCommand:, and that's probably why it works. The obj passed to handleOpenScriptCommand: looks weird, so perhaps it's badly formed, or maybe handleOpenScriptCommand: is broken; the direct object we pass is a list, so that seems right. - (void)_doOpenFiles:(id)obj { NSLog(@"%@", obj); [super _doOpenFiles:obj]; } - (short) _handleAEOpenDocuments: (id) obj; { NSLog(@"%@", obj); return [super _handleAEOpenDocuments:obj]; } - (void)handleOpenScriptCommand:(id)obj { NSLog(@"%@", obj); [super handleOpenScriptCommand:obj]; } |