Skip navigation.
 
mlRe: Trouble with setting up a command in an sdef file in a Cocoa app
FROM : Don Briggs
DATE : Thu Dec 09 06:00:08 2004

Hello, Steve --

I ran your sdef through sdp:
> /Developer/Tools/sdp -fst ImageBuddy.sdef

That operation yields a pair of files, *.scriptSuite and
*.scriptTerminology.

I used Suite Modeler to inspect the resulting pair.
Suite Modeler  found no errors to flag, but I noticed that the
*.scriptSuite declares
   doNo
as the class code for your command, whereas
   ibSs
is the default value of the class code for commands in that suite.

Referring back to you sdef, I find:
   code="doNoise "
declared for your command.

Looking back at the .scriptSuite file, I find that sdp has split your
8-char code for your command into
       <key>AppleEventClassCode</key>
       <string>doNo</string>
and
       <key>AppleEventCode</key>
       <string>ise </string>


I suggest you try using
   code="ibSsXXXX"
where XXXX is any (printable, non-control) four-character code.
For example,
   code="ibSsDoNo"
might work.

Also, Steve — you might want to check another list, too:
   <email_removed>

If it's any consolation, the body of documentation from Apple on Cocoa
AppleScriptability seems sparse to me.
If someone on these lists is aware of exactly where this is documented,
please let us all know.

Good luck,
   Don

On Dec 8, 2004, at 10:07 PM, Stephen J McIntosh wrote:

> I have a test application with an sdef file, where I would like to add
> a command "doNoise"
>
> The problem is that I get the AppleScript error message that "Can't
> continue doNoise"
>
> I can't find much info on setting up a command using an sdef, so any
> help/pointers would be very much appreciated.
>
> Thanks in advance
> Steve
>
>  I have:
> - setup a cocoa method in my delegated controller class to process the
> command
>     - (void)handleBlackWhiteNoise:(NSScriptCommand *)inCommand
> - here is the sdef file
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE dictionary SYSTEM
> "file://localhost/System/Library/DTDs/sdef.dtd">
> <dictionary title="ImageBuddy Terminology">
>     <suite name="ImageBuddy Suite" code="ibSs"
>         description="Commands and classes for the ImageBuddy application.">
>         <classes>
>             <class name="application" code="capp" description=""
>                 inherits="NSCoreSuite.NSApplication">
>                 <cocoa class="NSApplication"/>
>                 <responds-to-commands>
>                     <responds-to name="doNoise">
>                         <cocoa method="handleBlackWhiteNoise:"/>
>                     </responds-to>
>                 </responds-to-commands>                
>             </class>
>         </classes>
>
>         <commands>
>             <command name="doNoise" code="doNoise "
>                     description="Toggle the checkbox to add/remove black and white
> noise to the images.">
>                     <cocoa class="NSScriptCommand"/>
>             </command>
>         </commands>        
>     </suite>
> </dictionary>
>  _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list      (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>

Related mailsAuthorDate
mlTrouble with setting up a command in an sdef file in a Cocoa app Stephen J McIntosh Dec 9, 05:07
mlRe: Trouble with setting up a command in an sdef file in a Cocoa app Don Briggs Dec 9, 06:00