Added a new multitier request method. Fixed Feanor's lameness.
authorKent Sutherland <ksuther@ithinksw.com>
Thu, 6 Feb 2003 20:59:28 +0000 (20:59 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Thu, 6 Feb 2003 20:59:28 +0000 (20:59 +0000)
ITAppleEventCenter.h
ITAppleEventCenter.m

index d07de87..be94d4b 100755 (executable)
@@ -23,6 +23,7 @@
 + (id)sharedCenter;
 - (NSString*)sendAEWithRequestedKey:(NSString*)key eventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn;
 - (NSString*)sendTwoTierAEWithRequestedKey:(NSString*)key fromObjectByKey:(NSString*)object eventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn;
+- (NSString *)sendAEWithRequestedArray:(NSArray *)array eventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn;
 - (void)sendAEWithEventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn;
 - (void)printCarbonDesc:(AEDesc*)desc;
 @end
index 6490cfc..abb1823 100755 (executable)
@@ -182,6 +182,20 @@ static ITAppleEventCenter *_sharedAECenter = nil;
     }
 }
 
+- (NSString *)sendAEWithRequestedArray:(NSArray *)array eventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn
+{
+    //Build the send string
+    NSString *curString = [NSString stringWithFormat:@"{ form:'prop', want:type('prop'), seld:type('%s'), from:'null'() }", [[array objectAtIndex:0] UTF8String]];
+    int i;
+    for (i = 1; i < [array count]; i++) {
+        NSString *from = [NSString stringWithFormat:@"{ form:'prop', want:type('prop'), seld:type('%s'), from:obj %@ }",
+                    [[array objectAtIndex:i] UTF8String], curString];
+        curString = from;
+        NSLog(@"%@", from);
+    }
+    curString = [@"'----':obj " stringByAppendingString:curString];
+    return curString;
+}
 
 - (void)sendAEWithEventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn
 {
@@ -192,7 +206,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
         AEEventID    eID    = *((unsigned long*)[eventID UTF8String]);
         AppleEvent event, reply;
     
-        AECreateAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, kAnyTransactionID, &event);
+        AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, kAnyTransactionID, &event, nil, "");
     
         AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, nil, nil);