On Mar 30, 2005, at 10:36 AM, Gerard Brochu wrote:
Hello,
I want to call a C function with a parameter in an AppleScript
Studio application, I have look at in the developer examples for
AppleScript Studio in the Multi-Language projet how to call a C
function. In the project there is no parameter for the function, I
need to know how to pass a string parameter.
How can I modify the Multi-Language.mm file to pass the parameter
use in the following Script button ?
Here below are all the modified code from the Multi-Language projet
that I use in my own projet.
---------------------- The Script button
on clicked theObject
tell window of theObject
-- Call the Objective-C method "nameForCLanguage" defined
in "Multi-Language.h"
-- It in turn, will call a function defined in "C.h"
set contents of text field "MotDePasse" to call method
"nameForCLanguage" with parameter "Language C"
end tell
end clicked
{
// This will create a string using the c string returned from
the function call 'getNameForCLanguage' which is defined in "C.h"
and is implemented in "C.c".
NSString *languageName = [NSString
stringWithCString:getNameForCLanguage()]; // Return the
language name.
Use the variable here..
NSString *languageName = [NSString
stringWithCString:getNameForCLanguage([aString cString])];