Added a new AE method that handles custom timeouts. MenuTunes-1.6
authorKent Sutherland <ksuther@ithinksw.com>
Sun, 9 Oct 2005 21:05:09 +0000 (21:05 +0000)
committerKent Sutherland <ksuther@ithinksw.com>
Sun, 9 Oct 2005 21:05:09 +0000 (21:05 +0000)
ITAppleEventTools.h
ITAppleEventTools.m

index e38301a..3639f66 100644 (file)
@@ -19,4 +19,5 @@ extern NSString *_ITAEDescCarbonDescription(AEDesc desc);
 extern NSAppleEventDescriptor *ITSendAE(FourCharCode eClass, FourCharCode eID, const ProcessSerialNumber *psn);
 extern NSAppleEventDescriptor *ITSendAEWithKey(FourCharCode reqKey, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn);
 extern NSAppleEventDescriptor *ITSendAEWithString(NSString *sendString, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn);
+extern NSAppleEventDescriptor *ITSendAEWithStringAndTimeout(NSString *sendString, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn, long timeout);
 extern NSAppleEventDescriptor *ITSendAEWithStringAndObject(NSString *sendString, const AEDesc *object, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn);
\ No newline at end of file
index 0fe0b76..a61f5a4 100644 (file)
@@ -45,6 +45,10 @@ NSAppleEventDescriptor *ITSendAEWithKey(FourCharCode reqKey, FourCharCode evClas
 }
 
 NSAppleEventDescriptor *ITSendAEWithString(NSString *sendString, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn) {
+       ITSendAEWithStringAndTimeout(sendString, evClass, evID, psn, 60);
+}
+
+NSAppleEventDescriptor *ITSendAEWithStringAndTimeout(NSString *sendString, FourCharCode evClass, FourCharCode evID, const ProcessSerialNumber *psn, long timeout) {
        pid_t pid;
        AppleEvent sendEvent, replyEvent;
        AEDesc resultDesc;
@@ -66,7 +70,7 @@ NSAppleEventDescriptor *ITSendAEWithString(NSString *sendString, FourCharCode ev
                return nil;
        }
        
-       err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, /*kAEDefaultTimeout*/60, NULL, NULL);
+       err = AESend(&sendEvent, &replyEvent, kAEWaitReply, kAENormalPriority, /*kAEDefaultTimeout*/timeout, NULL, NULL);
        AEDisposeDesc(&sendEvent);
        
        if (err) {