[futurebasic] Re: [FB] Launching Apps, Open Docs, Open Docs with specific App, etc

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

From: "H. Gluender" <h@...>
Date: Sun, 6 Apr 2003 15:28:07 +0200
Dear George Beckmann,

thank you for pointing to the following code. It is from the FB^3 CD
and it is the version provided by Robert Purves. There are earlier
and very similar versions with the same functionality that also come
with the FB^3 CD. One is part of my AE2Finder Suite and others based
on it have been supplied by Alain Pastor.


>Below is FN OpenFileWithApplication.   Not sure where I got it, but it is
>much too complicated for me to have written, so I must have got it
>here...from you smart guys.
>
>local mode
>local fn OpenFileWithApplication( f as .FSSpec )
>'~'1
>dim as OSErr    err, ignore
>dim as OSType @ creator
>dim as AEDesc   addrDesc, theAE
>
>creator = _"MACS"
>err = fn AECreateDesc( _typeApplSignature, @creator, sizeof( OSType ),
>addrDesc )
>if err then exit fn
>err = fn AECreateAppleEvent( _kCoreEventClass, _kAEOpenDocuments, addrDesc,

>            _kAutoGenerateReturnID, _kAnyTransactionID, theAE )
>ignore = fn AEDisposeDesc( addrDesc )
>if err then exit fn
>
>err = fn AECreateDesc( _typeFSS, #f, sizeof( FSSpec ), addrDesc )
>if ( err == _noErr ) then err = fn AEPutParamDesc( theAE, _keyDirectObject,
>addrDesc )
>ignore = fn AEDisposeDesc( addrDesc )
>
>if ( err == _noErr ) then err = fn AESend( theAE, #_nil,
>_kAENoReply_kAECanInteract,¬
>           _kAENormalPriority, _kAEDefaultTimeout, _nil, _nil )
>ignore = fn AEDisposeDesc( theAE )
>end fn = err
>--


The above code is quite simple and works well under preOSX and OSX.
You may "open" any kind of files, i.e. docs and apps, with it.

The more complicated stuff (especially with respect to preOSX and
OSX) is to open docs with a specific app, i.e. not with the dedicated
app. This task becomes even more complicated, if the very app is not
yet running. That's why I wrote the previous "essay".

Best
--


                   Herbie

          ------------------------

          <http://www.gluender.de>