• 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: Executing AppleScript from Cocoa (with return values)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Executing AppleScript from Cocoa (with return values)


  • Subject: Re: Executing AppleScript from Cocoa (with return values)
  • From: email@hidden
  • Date: Mon, 18 Aug 2003 21:25:40 +0000

Ah, so this will keep the hierarchy of lists of lists [of lists [of lists
[...]]] of strings intact, correct? Pretty neat. I assume that you could
expand this to represent returned AppleScript records as NSMutableDictionary
objects within the hierarchy. For the application I have in mind, though, I
can manage with a list of lists.

I'm curious, though. Why do you resend [descriptor descriptorAtIndex:counter]
inside the else block when the result should already be in desc? Am I missing
something?
>
> I use this class method to turn an NSAppleEventDescriptor into an array
> of strings. Note that descriptorAtIndex: is 1-based, not 0-based.
>
> + (NSArray *)arrayFromDescriptor:(NSAppleEventDescriptor *)descriptor {
> NSMutableArray *returnArray = [NSMutableArray array];
> int counter, count = [descriptor numberOfItems];
>
> for (counter = 1; counter <= count; counter++) {
> NSAppleEventDescriptor *desc = [descriptor
> descriptorAtIndex:counter];
> if (nil != [desc descriptorAtIndex:1]) {
> [returnArray addObject:[self arrayFromDescriptor:desc]];
> } else {
> NSString *stringValue = [[descriptor
> descriptorAtIndex:counter] stringValue];
> if (nil != stringValue) {
> [returnArray addObject:stringValue];
> } else {
> [returnArray addObject:@""];
> }
> }
> }
> return (NSArray *)returnArray;
> }
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Executing AppleScript from Cocoa (with return values)
      • From: cricket <email@hidden>
  • Prev by Date: Re: Table view
  • Next by Date: Re: Executing AppleScript from Cocoa (with return values)
  • Previous by thread: Re: Executing AppleScript from Cocoa (with return values)
  • Next by thread: Re: Executing AppleScript from Cocoa (with return values)
  • Index(es):
    • Date
    • Thread