Lost on a one way street
Lost on a one way street
- Subject: Lost on a one way street
- From: Don Thompson <email@hidden>
- Date: Sat, 19 Mar 2005 12:28:35 -0800
Here is a really simple piece of code to communicate between AS and ObjC. The code will pass information from ObjC to AS; however, I am missing something for the return trip. Any help is greatly appreciated!!
OBJECTIVE C
#import <mach-o/dyld.h>
#import <Cocoa/Cocoa.h>
extern int NSApplicationMain(int argc, const char *argv[]);
NSString *x;
int main(int argc, const char *argv[])
{
x = @"hi don";
if (NSIsSymbolNameDefined("_ASKInitialize"))
{
NSSymbol *symbol = NSLookupAndBindSymbol("_ASKInitialize");
if (symbol)
{
void (*initializeASKFunc)(void) = NSAddressOfSymbol(symbol);
if (initializeASKFunc)
{
initializeASKFunc();
}
}
}
return NSApplicationMain(argc, argv);
}
@implementation NSApplication (ASKAMultiLanguage)
- (NSString *) returnMyX {
return x;
}
// This method is never called
+ (void) takeFromScript:(NSString *)value {
char buffer[200];
[value getCString : buffer];
printf("takeFromScript: \'%s\'\n", buffer);
}
@end
APPLESCRIPT
global x
on clicked theObject
set y to call method "returnMyX"
beep
display dialog "Hello World"
display dialog y
set u to "yurka"
call method "takeFromScript" with parameter u
end clicked
Thanks
Don Thompson _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden