[futurebasic] Re: [FB] Re: AppleScript with aete resource

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : March 2003 : Group Archive : Group : All Groups

From: Rich Love <richlove@...>
Date: Tue, 25 Mar 2003 17:48:22 -0600
George,

Thanks, I will try to make some sense of this in the morning and will 
let you know if I have some success.

Rich

On Tuesday, March 25, 2003, at 05:52  AM, GEORGE.ADAMS@... wrote:

> I have just gotten this to work on my first OS X application. I found a
> Freeware application that will allow you to create the aete resource. 
> It
> is EightyRez.
>
> The following chunk of code will help in showing how to handle the 
> apple
> events
>
> LOCAL FN handleAppleEvents
> dim position&
> 'print "gFBAEEvent& = " +str$(gFBAEEvent&)
> 'print "gFBAEType& = " + mki$(gFBAEType&)
> 'print "gFBAEReply& = " + str$(gFBAEReply&)
>
> select gFBAEType&
>
> case _"runS"
> FN pGbuild(_ControlWnd)'make sure control window is open
> fn runCameraSequence
> 'Print "Got runS as the type"
> 'print appleeventmessage$
> case _"movH"
> 'Print "Got movH as the type"
> 'print appleeventmessage$
> FN pGbuild(_ControlWnd)'make sure control window is open
> fn moveToPosition (gActiveCard$, _homePosition)
> 'add reply to apple event
> case _"movT"
> 'Print "Got movT as the type"
> 'print appleeventmessage$
> position& = val(appleeventmessage$)
> FN pGbuild(_ControlWnd)'make sure control window is open
> fn moveToPosition (gActiveCard$, position&)
> 'add reply to apple event
> case _"setO"
> Print "Got setO as the type"
> print appleeventmessage$
> case _"SndC"
> Print "Got setO as the type"
> print fn AE_Send_Command$(appleeventmessage$)
>
> case else
> Print "Unknown Type"
> end select
> end fn
>
> on appleevent (_"VRCl",_"runS") fn handleAppleEvents
> on appleevent (_"VRCl",_"movH") fn handleAppleEvents
> on appleevent (_"VRCl",_"movT") fn handleAppleEvents
> on appleevent (_"VRCl",_"setO") fn handleAppleEvents
> on appleevent (_"VRCl",_"SndC") fn handleAppleEvents
>
> You will see by all the commented out PRINT statements that I had a 
> bit of
> trouble with this. The ON APPLEEVENT function has the first two 
> parameters
> are reversed in the documentation.
> Currently these apple events either have no direct parameters sent 
> along
> with them or they are typeChar (_"TEXT") which can be easily retrieved
> from the global APPLEEVENTMESSAGE$.
> In the ON APPLEEVENT statements above the _"VRCl" is the Event Class in
> the aete resource and _"runS" and _"movH" are Event IDs
>
> If you get this all figured out I am still wanting to be able to get 
> other
> types of data from the script and return a message in aeReply and could
> use some help with that.I think I could figure it out eventually but 
> would
> rather see an example of someone else's code.
>
> George
> ----------
>
> I am in the process of adding AppleScript support to MacWise.
> The old AppleScript code I used in FB2 no longer works in carbon FB3.
>
> I looked in the examples in FB3 and did not find any example that uses
> the aete resource to receive apple events.
> Does anyone know where I can find an example of this?
>
> (You need to use the aete resource to make a library of AppleScript
> commands for your app.
> That way users can use the Apple Script Editor to write AppleScripts
> for your app).
>
>
> Rich Love - Carnation Software
> Terminal emulations for Macintosh - MacWise, MacToPic + and SBMac.
> richlove@...
> http://www.carnation-software.com
> 512 858-9234
Rich Love - Carnation Software
Terminal emulations for Macintosh - MacWise, MacToPic + and SBMac.
richlove@...
http://www.carnation-software.com
512 858-9234