realbasic-nug
[Top] [All Lists]

AppleEvents

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: AppleEvents
From: Drew Findley <drew at drewfindley dot com>
Date: Fri, 28 Jun 2002 11:34:54 -0700
A couple questions,

I am trying to add the ability for my app to control an application by AppleEvents (running on the same computer.) Both of these apps are written in house and I have some sample C code that gives me an example of how to do it although I am trying to do this in Realbasic.

I would also like to be able to record what the sample code is doing so I can look at it. In Matt's book he talks about a commercially available app. Is there anything for free out there?

Also if there is any additional info out there about AppleEvents in Realbasic please let me know. I kind of feel like I am flying blind.

The example code uses the following structure:

UInt8   lampdata[64] =
{
        0,0,0,255,255,0,0,255,
        1,5,0,0,0,0,0,0,
        0,0,-5,0,0,0,0,0,
        0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0,
        0,0,0,0,0,0,0,0
};

Event Class = 'MBox'
Event Type = 'CTRL'
Event parameter = 'DATA' (supply dfRec buffer, and byte count)

The following C code generates acceptable events:

To set up address of MBox application, using it's signature...

UInt32 signature = 'MBox';

AECreateDesc(typeApplSignature, &signature, sizeof(UInt32), &gTheAddress);
  To create an event (ourEvent):

AECreateAppleEvent('MBox', 'CTRL', &gTheAddress, kAutoGenerateReturnID, kAnyTransactionID, &ourEvent);


AEPutParamPtr(&ourEvent, 'DATA', typeLongInteger, &lampdata, 60);

To send the event:

AESend(&ourEvent, &ourReply, (gSendInteractArray[gInteract] + gSwitchLayer) + replyLevels[replyValue], kAENormalPriority,
               kAEDefaultTimeout,gAEIdleUPP, nil);

If this info is vague or incomplete it is because I new to AppleEvents and need to learn as much as possible as fast as possible.

Thanks in advance,
Drew

________________________________________________________

Drew Findley
Light & Sound Design, Inc / Fourthphase
drew at drewfindley dot com
________________________________________________________



<Prev in Thread] Current Thread [Next in Thread>
  • AppleEvents, Drew Findley <=