Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Cocoa AppleScripting woes

Cocoa AppleScripting woes
Thread Tools
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Mar 19, 2003, 03:27 AM
 
I'm attempting to add AppleScript support to a relatively simple application I'm working on. I've created the appropriate .scriptSuite:

http://people.AmbrosiaSW.com/~andrew/wt_scriptSuite.jpg

...and the .scriptTerminology:

http://people.AmbrosiaSW.com/~andrew...erminology.jpg

...and implemented the handlers in my NSPanel subclass:

@interface WireTapPanel : NSPanel

.....

-(void)handleRecordScriptCommand: (NSScriptCommand *)command;
-(void)handleStopScriptCommand: (NSScriptCommand *)command;
-(void)handlePauseScriptCommand: (NSScriptCommand *)command;

The AppleScript dictionary seems to get built okay (I can drag my app onto the ScriptEditor to see the terminology I'm exporting), yet when I send my app one of the commands I've specified to handle, such as:

tell application "WireTap"
record
end tell

...it doesn't handle the command properly, instead I get the following error:

2003-03-19 04:21:33.639 WireTap[8038] Suite NSCoreSuite, apple event code 0x3f3f3f3f
2003-03-19 04:21:33.643 WireTap[8038] Suite NSTextSuite, apple event code 0x3f3f3f3f
2003-03-19 04:21:33.688 WireTap[8038] Suite WireTap, apple event code 0x77546170
2003-03-19 04:21:33.692 WireTap[8038] Command: WireTap.Pause
Direct Parameter: (null)
Receivers: (null)
Arguments: {}
2003-03-19 04:21:33.694 WireTap[8038] Result: (null)
2003-03-19 04:21:33.696 WireTap[8038] Error: 4 "NSReceiversCantHandleCommandScriptError"

Anyone have any idea what I'm doing wrong?
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
moki  (op)
Ambrosia - el Presidente
Join Date: Sep 2000
Location: Rochester, NY
Status: Offline
Reply With Quote
Mar 20, 2003, 01:04 AM
 
I figured out what it was -- I had my NSPanel subclass being the one that responded to the commands in question... so telling the Application to do them accomplished nothing.

I moved them over to my app to handle, and all is well now. Thanks.
Andrew Welch / el Presidente / Ambrosia Software, Inc.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:54 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2