How come "call method" doesn't work?

How come “call method” doesn’t work? I’m trying to call Objective C from Applescript.


It seems that “call method” only is allowed if I create a n “Applescript Appliction”, not a “Cocoa Application”. Is this true? All I need to know is to how to pass data from Cocoa to Applescript. I already know how to call Applescript from Cocoa, but I need to “pass arguments” to that call.

What do you mean by that? Does your script compile? Does your method ever get the event? Does it run but not return anything? Does your script just time out when you run it? What OS version?


My search for “objective c” on this site came up with 11 threads. Here’s the link to one of them which I hope will be helpful:


Variable as the shade

My script does not compile. As a test, my script is currently:

set x to call method "scriptArg:" of class "ScriptInterface"

And the error I get when trying to save it is: “Syntax Error: An identifier can’t go after this identifier.” (“call method” is highlighted by the error.)

My real goal is to make a function call to Applescript and get the result. Lef f be an applescript function. I am able, using NSAppleScript, to simulate putting the result of f() into Objective C (that is, f with no args). But what if I want to call f with an argument from Objective-C? My idea was to just call f with no args, and then, in f (that is, inside AppleScript) I call Objective C to get the “argument”.

Yes, this will only work if you make an AppleScript Studio application because the “call method” call is part of the AppleScriptKit framework. You can retroactively add this framework to your Cocoa app and follow a few other steps (namely create a script, add a new AppleScript Studio build phase, and modify the InfoPlist settings). For more information, see: