[comp.sys.apple] Automatic Switching

STEIN@UCONNVM.BITNET (Alan Stein) (08/05/89)

  Does anyone know of a way of automatically switching programs at a given
time on a regular basis?  Someone I know needs to be able to run a certain
program constantly, but switch to another program every night at the same
time for about a half hour, then switch back, all unattended.


Alan H. Stein              | stein@uconnvm.bitnet
Department of Mathematics  | stein%uconnvm.bitnet@mitvma.mit.edu
University of Connecticut  | ...psuvax1!UCONNVM.BITNET!STEIN
32 Hillside Avenue         |
Waterbury, CT 06710        | Compu$erve  71545,1500
(203) 757-1231             | GEnie       ah.stein

lmb7421@ultb.UUCP (L.M. Barstow) (08/07/89)

Re: switching between the two programs....

On a GS, if the program that you want to run at night is home-grown, you
could install it as an init file of some sort, and install it into the
HeartBeat Interrupt queue with no major problem or slow-down.

Make the file a permanent init file,
Make most of the code dynamically loaded (so that it takes up minimal
space) if you have the program on a disk which is always in the drive
(on hard drive, etc)
Find the time from the Misc Tools
Calculate the number of tick until the program should switch (not hard -
subtract the current time from the time you want it to run - then
do some math to come up with 30 ticks for every second difference.)
Install the program into the HeartBeat Interrupt queue with the
calculated number of ticks.
end the program.
The boot sequence should leave everything intact, and other programs
whould run over top with no big problem (small slowdown, but nothing
huge) And when the other program is due to take over, it should switch
right in...only one problem I see, and that is that GS/OS may be tied up
when you interrupt, and you won't be able to do any disk access.  This
should be solveable by re-installing the task back into the queue for a
few seconds, and checking again.  

I haven't found any reason in the tech notes or docs why this wouldn't
work as a primitive switcher, although I wouldn't want to push it too
hard.  Any comments from those in the know?


-- 
Les Barstow                   |Bitnet: LMB7421@RITVAX                           
"What about the R.O.U.S's?"   |UUCP: ...rutgers!rochester!ritcv!ultb!lmb7421
"The Rodents Of Unusual Size? |ARPA: lmb7421@ultb.isc.rit.edu
I don't believe they exist!" - Buttercup and Wesley, _The Princess Bride_

daveharv@pro-novapple.UUCP (Dave Harvey) (08/09/89)

Network Comment: to #7828 by obsolete!STEIN%UCONNVM.BITNET%cunyvm.cuny.edu

There's a program furnished as part of Prosel called QUEUEP that is an
automatic program queue, allowing hands off sequencing and scheduling of
programs.  A program that is run from QUEUEP is on its own as far as its own
operation is concerned.  Thus, for automatic scheduling, the programs must
execute the QUIT command to prodos automatically upon completion.  If the
program expects user input then it can't be done hands off.  The program must
quit before QUEUEP can take over to run the next program.  The time to run the
second program can be included in the queue.
 
proline: pro-novapple!daveharv
uucp: crash!pro-novapple!daveharv
arpa: crash!pro-novapple!daveharv@nosc.mil
Internet: daveharv@pro-novapple.cts.com
DIALCOM: 164:NVC100
Northern Virginia Apple Users Group >pro-novapple< 703-671-0416/300-2400 baud