I want to write an ASOC application which starts running within the AppleScript environment and calls an ObjC method which calls an AppleScript handler within the same AppleScript environment from which the application started.
I know how to call from AppleScript into cocoa, but I don’t know how to make the call from cocoa back to the AppleScript handler.
Suppose my AppleScript app delegate looks like this:
script MyAppDelegate property parent : NSObject property theProperty : "didn't run yet" on applicationWillFinishLaunching_(notification) set theProperty to "it is running now" doit() of class "Util" of current application end applicationWillFinishLaunching_ on theHandler_(item) display dialog (theProperty & " ... " & item) end theHandler_ end script
Suppose my Objective C code looks like this. First, the Util.m file:
… and now, the Util.h file:
How do I implement the doit method within Util.m so that when I run this over-simplified sample application, a dialog box will pop up with the following text?
it is running now … foobar
Thanks in advance.