From 9c87a04ce0a9224430e24487efb73fab17078c31 Mon Sep 17 00:00:00 2001 From: Kent Sutherland Date: Sun, 9 Oct 2005 21:05:09 +0000 Subject: [PATCH] Added a new AE method that handles custom timeouts. --- ITAppleEventTools.h | 1 + ITAppleEventTools.m | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ITAppleEventTools.h b/ITAppleEventTools.h index e38301a..3639f66 100644 --- a/ITAppleEventTools.h +++ b/ITAppleEventTools.h @@ -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 diff --git a/ITAppleEventTools.m b/ITAppleEventTools.m index 0fe0b76..a61f5a4 100644 --- a/ITAppleEventTools.m +++ b/ITAppleEventTools.m @@ -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) { -- 2.20.1