Planet Bonk

2005-08-10

 

Rückgabewert von AppleScript in Cocoa verwenden

Ich habe mich gefragt, wie man den Rückgabewert eines AppleScripts in Cocoa-Awendungen verwenden kann. Nach einer Recherche müsste es so funktionieren:

...
NSString* script = @"return { \"a\", \"b\", \"c\"}";

NSAppleScript* myScript = [[NSAppleScript alloc] initWithSource:script];
NSMutableDictionary* errors;

NSAppleEventDescriptor* results = [myScript executeAndReturnError:&errors];

int i;

for( i = 0; i < [results numberOfItems]; i++ ) {
NSString* retVal = [[results descriptorAtIndex:i] stringValue];

...
}

...

Dieser Code ist allerdings noch nicht getestet...
Quelle: http://www.apfeltalk.de/archive/index.php?t-11969.html

Impressum

Archiv

2004/12
2005/01
2005/02
2005/03
2005/04
2005/05
2005/06
2005/07
2005/08
2005/09

This page is powered by Blogger. Isn't yours?