Re: Retrieving data returned by AppleScript [Solved]
Re: Retrieving data returned by AppleScript [Solved]
- Subject: Re: Retrieving data returned by AppleScript [Solved]
- From: Eric Morand <email@hidden>
- Date: Tue, 27 Dec 2005 16:35:05 +0100
After a lot of searches on the web, I finally found this :
http://www.cocoabuilder.com/archive/message/cocoa/2003/8/18/89025
It works pertfectly.
Eric.
Le 27 déc. 05 à 15:56, Eric Morand a écrit :
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
=============================================
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