Thanks, John and HAS. It turned out that after all was said and done, things were more complicted. I needed to be able to plug in a half dozen scripts, most of them a couple dozen lines, using some "System Events" GUI scripting. So I decided to ship them in Contents/Resources so they could be separately debugged and tested.
ObjC-appscript looks interesting but I already had it pretty well done before I read HAS's message, and it's not too much code, although I find it odd that Cocoa wouldn't have a method built in for doing this, and VERY odd that the descriptors use 1-based indexing like AppleScript. That was my main problem, John! John's code was very close. Here's the meat of the final version: NSAppleEventDescriptor* descriptor = [script executeAndReturnError:NULL] ; NSMutableDictionary* info = [NSMutableDictionary dictionary] ; NSInteger i ; for (i=1; i<=[descriptor numberOfItems]; i++) { // This loop should only execute once; [descriptor numberOfItems] = 1 NSAppleEventDescriptor* subdescriptor = [descriptor descriptorAtIndex:i] ; NSInteger nItems = [subdescriptor numberOfItems] ; // nItems should be 2 x number of values in the record if ((nItems > 0) && (nItems%2 == 0)) { NSUInteger j ; for(j=1; j<=[subdescriptor numberOfItems]/2; j++){ NSString* key = [[subdescriptor descriptorAtIndex:(2*j-1)] stringValue] ; NSString* value = [[subdescriptor descriptorAtIndex:(2*j)] stringValue] ; if (key && value) { [browmarkInfo setObject:value forKey:key] ; } } break ; } } _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com