Retrieving data returned by AppleScript
Retrieving data returned by AppleScript
- Subject: Retrieving data returned by AppleScript
- From: Eric Morand <email@hidden>
- Date: Tue, 27 Dec 2005 15:56:41 +0100
Hi List !
I'm currently trying to call an applescript from a COCOA code and am
having problems to retrieve the data returned by the script.
Here is the script (named getEncoder.scpt) :
tell application "iTunes"
set availableEncoders to (format of every encoder)
display dialog "It Works !!!"
return availableEncoders
end tell
And here is the code I use to execute it :
NSString *appleScriptPath = [[NSBundle bundleForClass:[self class]]
pathForResource:@"getEncoders" ofType:@"scpt"];
NSURL *url = [NSURL fileURLWithPath:appleScriptPath];
NSDictionary *theDict = [[[NSDictionary alloc] init] autorelease];
NSAppleScript *theScript;
NSAppleEventDescriptor *desc;
theScript = [[[NSAppleScript alloc] initWithContentsOfURL:url
error:&theDict] autorelease];
desc = [theScript executeAndReturnError:&theDict];
NSArray * avalaibleEncoders = [desc data];
The script is executed correctly (the "It Works" dialog appears) but
I'm unable to retrieve the data sent by the script (availableEcoders
remains empty).
Thanks,
Eric.
------------------------------------------------------------------------
--------
Automator Ketchup :
http://automatorketchup.blogspot.com/
_______________________________________________
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