objective c - Defining and executing simple AppleScript commands in a Cocoa app -


I am trying to add some scripting functionality to a coco app in writing. I have created a sdef (scripting definition file) for my project. So far, I have been able to reach the children (Elements) with the Apple script, but I want to Can not understand to call

This is my SDF file.

  & lt; Suite name = "mySuite" code = "msui" description = "my application suite" & gt; & Lt; Class name = "application" code = "capp" description = "top level scripting object." & Gt; & Lt; Cocoa class = "NSApplication" /> & Lt ;! - I can fix these elements - & gt; & Lt; Element Description = "Check Children." Type = "child" access = "r" & gt; & Lt; Cocoa key = "mychildren" /> & Lt; / Element & gt; & Lt ;! - This method may not appear to be called: (->  "testmethod">   Te & gt; & lt; / class & gt; & lt; class name = "child" code = "cHIL" description = "one child." Plural = "children" & gt; & lt; coca square = "hair" Property name = "name" code = "Pnam" description = "child's name." Type = "text" access = "r" & gt; & lt; coca key = "name" /> Gt; & lt; / property & gt; & lt; / class & gt; & lt; command name = "testmethod" code = "test" description = "execute test method" /> gt; & lt; / suite & Gt;  

These are the implementations of my controller class (this is representative of my application)

MyController.h

#import & lt; coco / cocoa h & gt; @ interface mac controller: nsobes {nsmutbalaarra * my child;} // some methods @end

MyController + Scripting.m

  #import "MyController + scripting .h" @implementation MyController // It works when I'm accessing my children- ( BOOL) Application: (NSApplication *) Annual representative HandslesKey: (NSString *) key {Anselog (@ "key =% @" key); Return ([Key EqualtoString: @ "My Child"]); } // This does not work ... - (zero) exposed method: (nsscript command *) command {nslog (@ "applied test script method% @", [command description]); } @end  

Finally, Apple script I am trying to:

  tell the application "MyApplication" testmethod end  

which responds with "AppleScript error - variable testmethod is not defined."

Any thoughts that I'm doing wrong here? I think I'm missing something simple but my Googling does not seem anything helpful.

"post-text" itemprop = "text">

Things look most appropriate, but & lt; Command / & gt; The code for should not be a two-part code (eight characters) and four.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -