Re: problem passing a list to an AppleScript function
Re: problem passing a list to an AppleScript function
- Subject: Re: problem passing a list to an AppleScript function
- From: Xavi Caballe Grebol <email@hidden>
- Date: Thu, 1 Dec 2005 01:13:56 -0800
On 1 Dec 2005, at 12:56 AM, Xavi Caballe Grebol wrote:
(Mmm... I've just realized... maybe the problem is that I'm not
really passing a list parameter, but a list of parameters? Anyway,
if that's the case, how do I pass a parameter of type list?).
that was the problem! I've finally solved by changing the code to
something like this (what I have changed is the code shown below the
quoted code)...
NSAppleEventDescriptor *listDescriptor = [NSAppleEventDescriptor
listDescriptor];
NSArray *listParamElements = [NSArray initWithObjects:@"element1",
@"element2", nil];
int i;
for (i = 0; i < [listParamElements count]; ++i) {
// note that the array starts at index 1
[listDescriptor insertDescriptor:[NSAppleEventDescriptor
descriptorWithString:[listParamElements objectAtIndex:i]]
atIndex:(i+1)];
}
// (...)
NSAppleEventDescriptor *parentListDescriptor =
[NSAppleEventDescriptor listDescriptor];
[parentListDescriptor insertDescriptor:listDescriptor
atIndex:1];
[event setParamDescriptor:parentListDescriptor
forKeyword:keyDirectObject];
Cheers,
xavi
_______________________________________________
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