From 8d770173cee35e1b6139ee6ccb1511ccfa55a3c2 Mon Sep 17 00:00:00 2001 From: Alexander Strange Date: Sat, 3 Apr 2004 21:30:51 +0000 Subject: [PATCH] More work on ITAppleEventTools and also fix a compiler warning --- ITAppleEventTools.m | 21 ++++++++++++++++++++- ITByteStream.m | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/ITAppleEventTools.m b/ITAppleEventTools.m index a236816..6eb927c 100755 --- a/ITAppleEventTools.m +++ b/ITAppleEventTools.m @@ -50,8 +50,27 @@ NSAppleEventDescriptor *ITSendAEWithKey(FourCharCode reqKey, FourCharCode evClas { } -NSAppleEventDescriptor *ITSendPlainAE(FourCharCode evClass, FourCharCode evID,const ProcessSerialNumber *psn) +NSAppleEventDescriptor *ITSendPlainAE(FourCharCode eClass, FourCharCode eID,const ProcessSerialNumber *psn) { + AEDesc dest; + int pid; + + AppleEvent event, reply; + OSStatus cerr,cerr2,err; + NSAppleEventDescriptor *nsd, *nse, *nsr; + if ((GetProcessPID(&psn, &pid) == noErr) && (pid == 0)) { + ITDebugLog(@"Error getting PID of application."); + return; + } + cerr = AECreateDesc(typeProcessSerialNumber,(ProcessSerialNumber*)&psn,sizeof(ProcessSerialNumber),&dest); + nsd = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&dest] autorelease]; + cerr2 = AECreateAppleEvent(eClass,eID,&dest,kAutoGenerateReturnID,kAnyTransactionID,&event); + nse = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&event] autorelease]; + if (!cerr2) [nse logDesc]; + err = AESend(&event, &reply, kAENoReply, kAENormalPriority, kAEDefaultTimeout, NULL, NULL); + nsr = [[[NSAppleEventDescriptor alloc] initWithAEDescNoCopy:&reply] autorelease]; + [nsr logDesc]; + return nsr; } @implementation NSAppleEventDescriptor (ITAELogging) diff --git a/ITByteStream.m b/ITByteStream.m index e4607b4..664e1a0 100755 --- a/ITByteStream.m +++ b/ITByteStream.m @@ -61,6 +61,11 @@ return old; } +-delegate +{ + return delegate; +} + -(int) availableDataLength { int len; -- 2.20.1