AEBuildError buildError;
OSStatus err;
- OSErr err2, err3;
+ OSErr berr, err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"Error getting PID of application! Exiting.");
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//joe add the ITFDEBUG stuff back?
//[self printCarbonDesc:&sendEvent];
free(result);
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return _finalString;
}
Size resultSize, charResultSize;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr,err;
OSErr err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
-
- //[self printCarbonDesc:&sendEvent];
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ NSLog(@"sending...");
+ if (!berr) [self printCarbonDesc:&sendEvent];
- if (err) {
+ if (berr) {
//NSLog(@"%d:%d at \"%@\"",(int)buildError.fError,buildError.fErrorPos,[nssendString substringToIndex:buildError.fErrorPos]);
}
err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, kNoTimeOut, idleUPP, NULL);
-
- //[self printCarbonDesc:&replyEvent];
+ NSLog(@"replying...");
+ if (!err) [self printCarbonDesc:&replyEvent];
if (err) {
//NSLog(@"Send Error: %i",err);
free(result);
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return _finalString;
}
AEBuildError buildError;
OSStatus err;
- OSErr err2, err3;
+ OSErr berr, err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"Error getting PID of application! Exiting.");
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
}
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return result;
}
Size resultSize, charResultSize;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr,err;
OSErr err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
free(result);
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return _finalString;
}
Size resultSize, charResultSize;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr, err;
OSErr err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
// //NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
}
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return result;
}
Size resultSize, charResultSize;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr, err;
OSErr err2, err3;
for (i = 1; i < [array count]; i++) {
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
}
free(result);
}
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return _finalString;
}
int pid;
AppleEvent event, reply;
-
+ OSStatus cerr,cerr2,err;
//AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, kAnyTransactionID, &event, nil, "");
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"Error getting PID of application! Exiting.");
return nil;
}
- AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest);
- AECreateAppleEvent(eClass,eID,&dest,kAutoGenerateReturnID,kAnyTransactionID,&event);
+ cerr = AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest);
+ cerr2 = AECreateAppleEvent(eClass,eID,&dest,kAutoGenerateReturnID,kAnyTransactionID,&event);
//[self printCarbonDesc:&event];
- AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, idleUPP, nil);
+ err = AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, idleUPP, nil);
//[self printCarbonDesc:&reply];
- AEDisposeDesc(&dest);
- AEDisposeDesc(&event);
- AEDisposeDesc(&reply);
+ if (!cerr2) AEDisposeDesc(&dest);
+ if (!cerr) AEDisposeDesc(&event);
+ if (!err) AEDisposeDesc(&reply);
}
- (void)printCarbonDesc:(AEDesc*)desc {
Size resultSize, charResultSize;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr, err;
OSErr err2, err3;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
}
-AEDisposeDesc(&sendEvent);
-AEDisposeDesc(&replyEvent);
+if (!berr) AEDisposeDesc(&sendEvent);
+if (!err) AEDisposeDesc(&replyEvent);
//NSLog(@"waffles say %d",result);
return result;
}
AppleEvent sendEvent, replyEvent;
AEBuildError buildError;
- OSStatus err;
+ OSStatus berr, err;
if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) {
//NSLog(@"Error getting PID of application! Exiting.");
//NSLog(@"_sendString: %s", sendString);
- err = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
+ berr = AEBuildAppleEvent(eClass, eID, typeProcessSerialNumber,(ProcessSerialNumber*)&psn, sizeof(ProcessSerialNumber), kAutoGenerateReturnID, 0, &sendEvent, &buildError, sendString);
//[self printCarbonDesc:&sendEvent];
free(result);
}
- AEDisposeDesc(&sendEvent);
- AEDisposeDesc(&replyEvent);
+ if (!berr) AEDisposeDesc(&sendEvent);
+ if (!err) AEDisposeDesc(&replyEvent);
return result;
}