[futurebasic] Re: [FB] Quit AppleEvent WAS Re: [FB] [FBII] Application Boot during Startup

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

From: Phil Yates <phil.yates@...>
Date: Wed, 26 Apr 2000 09:01:52 +0100
on 26/4/00 3:21 am, BHEIBERT810@... at BHEIBERT810@... wrote:

> How do I send a Quit AppleEvent to the Finder?
> 
> --
> To unsubscribe, send ANY message to <futurebasic-unsubscribe@...>
> 

I have a LARGE and very processor-intensive Simulation system, written in
FB3. I wish to ensure that this gets all of the CPU time. Thus when it
starts up, it shuts down everything else running on the computer. When the
program quits, the system automatically reboots the Finder.

These two functions do it, but you'll also have to have the AppleEvents
filter installed.

As a matter of interest, I'm often surprised what else is running (and thus
taking CPU time). Most of the processes it shuts down don't appear on the
Application Menu.

Phil.

'~'
' FUNCTION : Handle Apple Events
'~'
LOCAL
DIM Process,toProcess$
LOCAL FN SendAEQuit
FOR Process = 0 TO 19
toProcess$ = INDEX$(Process,9)
LONG IF LEN(toProcess$)
CALL MOVETO (15,110)
PRINT "Sending Quit to ";toProcess$;"                              ";
FN AEsendQuit(toProcess$)
DELAY 600
END IF
NEXT Process
END FN
'~'
' FUNCTION : Shuts down all running processes with AE
'~'
LOCAL
DIM TempT,TempL,TempB,TempR
LOCAL FN ShutdownProcesses
CLS
LONG COLOR 0,0,65535
TEXT _NewYork,18,0,0
CALL MOVETO (15,50)
PRINT "Terminating other programs ... ";
FN AElistProcesses(9)
FN SendAEQuit
END FN