I am so thankful for the kind help I have received from this list. It
has helped me to much better understand implementing Applescript in
my app. It was such good help that I felt sure that my new command
would work eventually, but it just won't.
I would like to describe what I have done and see if anyone spots
anything missing. I am using the steps outlined on Script Commands
Overview, although I have read through the entire guide many times
looking for clues: http://developer.apple.com/documentation/Cocoa/Conceptual/
ScriptableCocoaApplications/SApps_script_cmds/
chapter_8_section_3.html#//apple_ref/doc/uid/20001242-SW2
My app is currently OK supporting getting and setting properties via
applescript, and I have successfully implemented the Core command
"make" to create new objects. Now I want to create a new object-first
command called "complete".
1. In my sdef, I provided a responds-to entry for my scheduled order
class (a subclass of order) that is meant to handle the command:
<class name="scheduled order" code="SORD" inherits="order"
description="An order that is currently scheduled for production.">
<cocoa class="Order"/>
2. Since it's a new applescript command, I added a command element to
my sdef. The following snippet appears directly below the above one,
inside my app's custom suite:
<!-- Commands -->
<command name="complete" code="SK3DCOMP" description="Complete an
object to indicate that work has been completed.">
<direct-parameter type="order"/>
</command>
I'm not subclassing NSScriptCommand because I believe for this simple
object-first command I don't need to.
When I call "complete myOrder" in script editor, I get "Scheduler got
an error: NSReceiversCantHandleCommandScriptError"
2007-11-19 10:09:54.500 Scheduler[571] Command: Intrinsics.get
Direct Parameter: <NSUniqueIDSpecifier: scheduledOrders with an ID
of "24778">
Receivers: <NSUniqueIDSpecifier: scheduledOrders with an ID of "24778">
Arguments: {}
2007-11-19 10:09:54.500 Scheduler[571] key checked = scheduledOrders
2007-11-19 10:09:54.500 Scheduler[571] key checked = scheduledOrders
2007-11-19 10:09:54.500 Scheduler[571] key checked = scheduledOrders
2007-11-19 10:09:54.500 Scheduler[571] Property Value: 24778 (5)
2007-11-19 10:09:54.501 Scheduler[571] objectSpecifier: 24778 (7)
2007-11-19 10:09:54.501 Scheduler[571] Result:
<NSAppleEventDescriptor: 'obj '{ 'from':''null''(), 'want':'Ordr',
'form':'ID ', 'seld':'utxt'($32003400370037003800$) }
2007-11-19 10:09:54.516 Scheduler[571] Command: Scheduler Suite.complete
Direct Parameter: <NSUniqueIDSpecifier: orders with an ID of "24778">
Receivers: <NSUniqueIDSpecifier: orders with an ID of "24778">
Arguments: {}
2007-11-19 10:09:54.516 Scheduler[571] key checked = orders
2007-11-19 10:09:54.517 Scheduler[571] key checked = orders
2007-11-19 10:09:54.517 Scheduler[571] key checked = orders
2007-11-19 10:09:54.517 Scheduler[571] Result: (null)
2007-11-19 10:09:54.517 Scheduler[571] Error: 4
"NSReceiversCantHandleCommandScriptError"
"key checked" is a log entry that is in my application:
delegateHandlesKey: method which resides in my AppController class
which is the app's delegate. I don't know why it gets called three
times in a row, but here is the method in case it looks crazy to anyone:
I am thankful for any ideas.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-implementors mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-implementors/email@hidden