• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Passing data between Applescript and ObjC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing data between Applescript and ObjC


  • Subject: Passing data between Applescript and ObjC
  • From: Don Thompson <email@hidden>
  • Date: Mon, 21 Mar 2005 11:48:07 -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

  • Follow-Ups:
    • Re: Passing data between Applescript and ObjC
      • From: Charilaos Skiadas <email@hidden>
  • Prev by Date: Re: (newbie question) Putting special characters in NSStrings
  • Next by Date: Re: Can't open a sheet on a panel twice (Modified by OS) (apologies)
  • Previous by thread: Re: Simple Prog. w/ AU (Audio Units)
  • Next by thread: Re: Passing data between Applescript and ObjC
  • Index(es):
    • Date
    • Thread