[futurebasic] Re: [FB] Open document with appleEvents

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

From: AlStaff@...
Date: Thu, 24 Jun 2004 05:28:16 EDT
>The following code works just fine in OS X but in OS 9 Classic it does
>not work. It reaches the test BEEPs but the application and document 
>are not launched. In my test I'm using a document ("fees") created with
>the SimpleText (OS 9) application. I suspect this is related to some 
>peculiarity with Classic versus a real OS 9 install. I've got all the 
>extensions and control panels loaded in 9 that I can find.  Any 
>suggestions?


AppleEvents and AppleScript has been made much easier in recent releases of 
FB. I've been using a lot more AS to do certain things. Try this:


include "Subs AppleScript.Incl"

DIM AppToLaunch$
DIM DocName$
DIM ASresult$
DIM err
DIM gAScontainer$$

gAScontainer$$ = ""
AppToLaunch$ = "SimpleText"
DocName$ = "Fees"

gAScontainer$$ = "Tell application " + CHR$(34) + AppToLaunch$ + CHR$(34)
gAScontainer$$ += CHR$(13)
gAScontainer$$ += "Activate"
gAScontainer$$ += CHR$(13)
gAScontainer$$ += "open file " + CHR$(34) + DocName$ + CHR$(34)
gAScontainer$$ += CHR$(13)
gAScontainer$$ += "End Tell"

ROUTE _toAppleScript
PRINT gAScontainer$$
ROUTE _toScreen
err = Usr AppleScriptRun( ASresult$ )
gAScontainer$$ = ""

WHILE 1
  HANDLEEVENTS
WEND


Al Staffieri Jr.

AlStaff@...
http://members.aol.com/AlStaff/index.html