Builds again
[ITFoundation.git] / ITAppleEventCenter.m
index 30d14b1..2466e43 100755 (executable)
@@ -70,7 +70,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
@@ -78,7 +78,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, kNoTimeOut, idleUPP, NULL);
 
-    //[self printCarbonDesc:&replyEvent];
+    [self printCarbonDesc:&replyEvent];
 
     if (err) {
         NSLog(@"Send Error: %i",err);
@@ -131,7 +131,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
            return nil;
        }
        */
-    NSLog(@"_sendString: %s", sendString);
+    //NSLog(@"_sendString: %s", sendString);
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
@@ -201,7 +201,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
@@ -261,7 +261,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
@@ -269,7 +269,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, kNoTimeOut, idleUPP, NULL);
 
-    //[self printCarbonDesc:&replyEvent];
+    [self printCarbonDesc:&replyEvent];
 
     if (err) {
         NSLog(@"Send Error: %i",err);
@@ -327,7 +327,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
@@ -395,7 +395,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[buildString substringToIndex:buildError.fErrorPos]);
@@ -403,7 +403,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, kNoTimeOut, idleUPP, NULL);
 
-    //[self printCarbonDesc:&replyEvent];
+    [self printCarbonDesc:&replyEvent];
 
     if (err) {
         NSLog(@"Send Error: %i",err);
@@ -439,18 +439,19 @@ static ITAppleEventCenter *_sharedAECenter = nil;
     //AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, kAnyTransactionID, &event, nil, "");
     AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest);
     AECreateAppleEvent(eClass,eID,&dest,kAutoGenerateReturnID,kAnyTransactionID,&event);
+[self printCarbonDesc:&event];
     AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, idleUPP, nil);
-
+[self printCarbonDesc:&reply];
     AEDisposeDesc(&dest);
     AEDisposeDesc(&event);
     AEDisposeDesc(&reply);
 }
 
 - (void)printCarbonDesc:(AEDesc*)desc {
-    /*Handle xx;
+    Handle xx;
     AEPrintDescToHandle(desc,&xx);
     NSLog(@"Handle: %s", *xx);
-    DisposeHandle(xx);*/
+    DisposeHandle(xx);
 }
 
 
@@ -474,7 +475,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
@@ -482,7 +483,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, kNoTimeOut, idleUPP, NULL);
 
-    //[self printCarbonDesc:&replyEvent];
+    [self printCarbonDesc:&replyEvent];
 
     if (err) {
         NSLog(@"Send Error: %i",err);
@@ -509,13 +510,13 @@ static ITAppleEventCenter *_sharedAECenter = nil;
     AEEventID    eID    = *((unsigned long*)[eventID UTF8String]);
 
     const char *sendString = [string UTF8String];
-    long result = 0;
+    SInt32 result = 0;
 
     AppleEvent sendEvent, replyEvent;
 
     DescType resultType;
     Size resultSize, charResultSize;
-    
+
     AEBuildError buildError;
     OSStatus err;
     OSErr err2, err3;
@@ -555,10 +556,11 @@ static ITAppleEventCenter *_sharedAECenter = nil;
         }
     }
 
-    AEDisposeDesc(&sendEvent);
-    AEDisposeDesc(&replyEvent);
 
-    return result;
+AEDisposeDesc(&sendEvent);
+AEDisposeDesc(&replyEvent);
+NSLog(@"waffles say %d",result);
+return result;
 }
 
 - (AEArrayDataPointer)sendAEWithSendStringForArray:(NSString*)string eventClass:(NSString*)eventClass eventID:(NSString*)eventID appPSN:(ProcessSerialNumber)psn
@@ -584,7 +586,7 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
 
-    //[self printCarbonDesc:&sendEvent];
+    [self printCarbonDesc:&sendEvent];
 
     if (err) {
         NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[string substringToIndex:buildError.fErrorPos]);
@@ -611,4 +613,4 @@ static ITAppleEventCenter *_sharedAECenter = nil;
 
     return result;
 }
-@end
+@end
\ No newline at end of file