[futurebasic] Apple Events: Why should I?

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 2004 : Group Archive : Group : All Groups

From: BrucesFB3@...
Date: Thu, 9 Sep 2004 07:37:44 EDT
Alain,

Again thanks for the helpful suggestions. I will try them,
but.......

Adding Apple Events falls under the heading "Woah, back
the truck up!" for me.

Please be aware that you are thinking on a whole different
level than I am. Apple Events are not on my radar scope.
In the thread indicated below I told RC and RP where I am
coming from. Refer back to my post in "Re: [FB] Opening
Files from Finder" Wed Sep 8 12:53:50 2004.

With that in mind let me cut to the chase. Why should I
want to use Apple Events? What advantages do they offer
me? I went back to my FB II Handbook and looked up
Apple Events. They explain how to use them, but do not
tell me WHY I should use them. I assume the FB II Handbook
may be dated. I am taking that into account.

On Wed Sep 8 16:27:04 2004 Alain Pastor wrote in the
"Re: [FB] Opening Files from Finder" thread:

>The code I'm going to suggest has not been tested at all, so use it 
>with caution.

>Then I would add an AppleEvent vector for the oDoc event:

>Kill AppleEvent _kRequiredEventClass, _kAEOpenDocuments
>On AppleEvent ( _kRequiredEventClass, _kAEOpenDocuments ) Fn AEReadFile

>That would call a function a bit like this:

>Clear Local Fn AEReadFile
>Dim As AEDesc   AEDesc
>Dim As FSSpec   fSpec
>Dim As Int      i
>Dim As Long @   count, actualSize, keyWord, rtnType

>Long If Fn AEGetParamDesc( gFBAEEvent, _keyDirectObject, 
>_typeAEList, AEDesc ) = _noErr
>Long If Fn AECountItems( AEDesc, count ) = _noErr
>For i = 1 To count
>Long If Fn AEGetNthPtr( AEDesc, i, _typeFSS, keyWord, rtnType, 
@fSpec, Sizeof(FSSpec), actualSize ) = _noErr
>Fn ReadFile( fSpec )
>End If
>Next
>End If
>i = Fn AEDisposeDesc( AEDesc )
>End If

>End Fn

>Generally with such type of code we often check the type and creator 
>code of the file that must be manipulated. For that purpose, you 
>have at your disposal the FSpGetFInfo Toolbox function:

>Dim As FInfo    info

>Long If Fn FSpGetFInfo( fSpec, info ) = _noErr
>// info.fdType contains the file type
>// info.fdCreator contains the creator code
>End If

>Alain


--
To unsubscribe, send ANY message to: futurebasic-unsubscribe@...