facebook twitter google+ linkedin reddit delicious stumbleupon

Tracking Apple events

Gang stalking electronic harassment implants website sharing buttons gang stalking electronic harassment implants

gsehi.com > Computing > Problems > Tracking Apple events

Problem

I need to track Apple events.

Solution 1

AEGetTheCurrentEvent can be used in a GetNextEvent patch and a WaitNextEvent patch to detect null events. This allows you to give your INIT time at a moment that it doesn’t bother other processes.

From AEInteraction.h from Universal Interfaces 3.4.1:

/**************************************************************************
 The following four calls are available for applications which need more
 sophisticated control over when and how events are processed. Applications
 which implement multi-session servers or which implement their own
 internal event queueing will probably be the major clients of these
 routines. They can be called from within a handler to prevent the AEM from
 disposing of the AppleEvent when the handler returns. They can be used to
 asynchronously process the event (as MacApp does).
**************************************************************************/

/*
 *  AEGetTheCurrentEvent()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API( OSErr )
AEGetTheCurrentEvent(AppleEvent * theAppleEvent)              THREEWORDINLINE(0x303C, 0x021A, 0xA816);

Solution 2

This method allows you to record events from processes which send events even when they haven’t been notified that someone is recording.

From AppleEvents.h from Universal Interfaces 3.4.1:

/**************************************************************************
  These calls are used to set up and modify special hooks into the
  AppleEvent manager.
**************************************************************************/
/*
 *  AEInstallSpecialHandler()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API( OSErr )
AEInstallSpecialHandler(
  AEKeyword           functionClass,
  AEEventHandlerUPP   handler,
  Boolean             isSysHandler)                           THREEWORDINLINE(0x303C, 0x0500, 0xA816);


/*
 *  AERemoveSpecialHandler()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API( OSErr )
AERemoveSpecialHandler(
  AEKeyword           functionClass,
  AEEventHandlerUPP   handler,
  Boolean             isSysHandler)                           THREEWORDINLINE(0x303C, 0x0501, 0xA816);


/*
 *  AEGetSpecialHandler()
 *  
 *  Availability:
 *    Non-Carbon CFM:   in InterfaceLib 7.1 and later
 *    CarbonLib:        in CarbonLib 1.0 and later
 *    Mac OS X:         in version 10.0 and later
 */
EXTERN_API( OSErr )
AEGetSpecialHandler(
  AEKeyword            functionClass,
  AEEventHandlerUPP *  handler,
  Boolean              isSysHandler)                          THREEWORDINLINE(0x303C, 0x052D, 0xA816);

AEInstallSpecialHandler documentation

AERemoveSpecialHandler documentation

Later they allowed also different function class parameters:

PDF file icon Creating and managing the special handler dispatch tables by Apple (116.8 K, 5 pages).

Solution 3

If you call OSAStartRecording then it installs an event handler for the kAENotifyRecording event. Then a copy of the events that other programs send with AESend will be sent to your program. This handler will then convert the event to text and send it with AESend to itself where you can handle it with an event handler for the kOSARecordedText event. This event contains a direct object of type ‘STXT’ (styled text). This has to be coerced to a record. Then you can get the ‘TEXT’ and the ‘styl’.

Trick #1 is now to install your own kAENotifyRecording event handler right after you call OSAStartRecording. If you want also the recorded text, then your kAENotifyRecording event handler needs to invoke the original handler.

Trick #2 is now to pass your component instance as the handlerRefcon, otherwise you get error badComponentInstance. Then you arrive in your own kOSARecordedText event handler.

This method has several advantages:

This method has also disadvantages:

© 2017 Cliff Huylebroeck