• 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
Re: problem passing a list to an AppleScript function
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
References: 
 >problem passing a list to an AppleScript function (From: Xavi Caballe Grebol <email@hidden>)

  • Prev by Date: problem passing a list to an AppleScript function
  • Next by Date: Graphics Binding & keys on a deeper level
  • Previous by thread: problem passing a list to an AppleScript function
  • Next by thread: Graphics Binding & keys on a deeper level
  • Index(es):
    • Date
    • Thread