| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | XBOOT3.BTM |
Hello Jasen,
I /*think*/ I have a "stable" version for you to test out for me....
I still haven't figured out how to handle the four echo commands in the
manner that you desire....
I am working on a method to change to date formatting within the data file,
but in the meantime, you'll have to manually change the dates...
=== Cut Begin: XBOOT3.BTM ===
:: XBOOT3.BTM VERSION 1.3 Oct-19-2002
:: 01:30:00
:: (Once a day program upon boot execution)
::
:: by Gerald Miller
:: Fidonet 1:342/512
::
:: based on the original XBOOTEX.BTM by Klaus Meinhard
:: Brahmsstr. 12
:: G 26842 Ostrhauderfehn
:: Germany
:: Compuserve 100115,2025
::
:: For those of you who have more extensive needs than can be filled
:: by XDAILY.BTM, here is a utility that allows you a very versatile
:: handling of programs you want to run only once a day at first boot
:: time.
::
:: XBOOT3 allows you to specify as many programs as you wish in the
:: data file XBOOT3.DAT, with an interval in days for running each
:: program and the possibility to ask if the program should be run
:: (nice if you do not have the time for it just then). You will be
:: asked again the next day if you skip.
::
:: If you want to run another batch file, enter `CALL c:\path\mybatch`
:: in XBOOT3.DAT to insure the return to XBOOT3.BTM after execution.
::
:: So maybe you want to run STACKER's CHECK every day, but a virus
:: scanner only once a week, and defrag once a month? No problem,
:: just fill in those programs in XBOOT3.DAT with the appropriate
:: parameters. Just be careful not to change the formatting of that
:: file, because XBOOT3.BTM depends on it.
::
:: There is an example data file (XBOOT3.DAT) which shows the working of
:: all this and makes calls to eight BTM files to show you how XBOOT3
:: works.
::
:: Some of the NEXT RUN date field and DAYS LEFT field within the
:: XBOOT3.DAT file are "zeroed" out on the theory that the first time you
:: execute the XBOOT3.BTM, all the fields should contain the "correct"
:: data upon completion.
::
:: The eight "simple" BTM files all echo their name to the screen and
:: "touch themselves" when called upon based on the information contained
:: in the data file. (The date and time stamp of the eight BTM files will
:: change based on execution.)
::
:: Call XBOOT3.BTM from your autoexec.bat. XBOOT3.DAT _must_ be in
:: your path or the root dir of your boot drive!
::
:: ** Features fixed / added / pending:
::
:: - Removed all "_" characters from non-4DOS variable names to avoid
:: possible conflict of future 4DOS variable names. (Thanks Jasen
:: Betts {at}Fidonet 3:640/531.42)
:: - Calculate the date of a program's next call.
:: - Calculate the number of days remaining until the next call.
::
:: I recommend that all the CALLed batch files end with:
::
:: touch /q %_batchname
::
:: to serve as an indicator of when that batch file was last run. I
:: ****DO NOT**** recommend that you use the touch command on
:: ****ANY**** executable (i.e.: *.EXE, *.CMD, etc.) file!!!
::
:: Further suggestions welcome
::
:START
*setlocal
*unalias *
:: The following section will change the date and time stamp of XBOOT3.BTM
:: I use the data to maintain the XBOOT3.BTM version number sequence.
:: PLEASE LET ME KNOW IF THE TOUCH SEQUENCE SHOULD GIVE YOU ANY PROBLEMS.
iff %{at}fileage[%_batchname] ne %{at}makeage[10-19-02,01:30:00] then
touch /d10-19-02 /t01:30:00 %_batchname
endiff
:: ###WARNING###
:: You ARE required to change "q3" (in the next line) to the path\name
:: of your text editor!!!
:: DO IT NOW BEFORE YOU GET AN ERROR MESSAGE IF THERE IS AN ERROR!!!
:: "Q3" is my version of the Semware Editor.
on error (q3 /n%_batchline %{at}search[%0] %+ quit)
on break goto END
if "%temp" eq "" set temp=C:\
:: Next command establishes the location of the variable "BOOTFILE"
:: (XBOOT3.DAT) [should probably be in the same directory as this BTM
:: file...]
set bootfile=%{at}path[%{at}search[%0]]%{at}name[%0].DAT
:: Next command establishes the location and name of the variable "TEMP"
:: that holds the temporary information while the action is performed.
set temp=%temp\%{at}name[%0].TMP
:: User input
if [%1]==[-?] .or. [%1]==[/?] .or. [%1]==[?] goto USAGE
:: Is the file XBOOT3.DAT there? Where?
iff not exist %bootfile then
echo.
color bri red on whi
echo ERROR: %{at}path[%{at}search[%0]]%{at}name[%0].DAT not found!
color bri cya on bla
echo.
delay 5
goto END
endiff
:: Set variables. If XBOOT3 did it's job today already or it's before
:: 00:01 am, do nothing. In this case, the "start" time is 00:01 am....
set lastdate=%{at}date[%{at}filedate[%bootfile]]
set today=%{at}date[%_date]
set dotime=00:01
if %{at}eval[%lastdate - %today] eq 0 .or. %{at}eval[%{at}time[%_time] - %=
%{at}time[%dotime]] le 0 goto END
:: Read XBOOT3.DAT, look at which progs to run today, copy info to
:: XBOOT3.TMP and update XBOOT3.DAT
set i=0
echo.
echo %{at}line[%bootfile,0]>%temp
echo %{at}line[%bootfile,1]>>%temp
echo %{at}line[%bootfile,2]>>%temp
do n=3 to %{at}lines[%bootfile]
set prog=%{at}instr[0,41,%{at}line[%bootfile,%n]]
set when=%{at}instr[42,5,%{at}line[%bootfile,%n]]
set last=%{at}instr[48,8,%{at}line[%bootfile,%n]]
set next=%{at}instr[57,8,%{at}line[%bootfile,%n]]
set left=%{at}instr[66,5,%{at}line[%bootfile,%n]]
set ask=%{at}instr[72,1,%{at}line[%bootfile,%n]]
iff %{at}eval[%today-%{at}date[%last]] ge %when .and. "%prog" ne
"" then
iff "%ask" eq "Y" then
beep 294 2 330 2 277 2 294 2 330 2 277 2 294 2 330 2 277 2 294 2 %=
330 2 0 2 139 2 165 2 196 2 233 2 277 2 466 2 554 2 659 2 784 2 932 2
scrput %_row %{at}eval[17+%{at}len[%prog]] bri yel on bla `Y`
inkey /c/K"YN[esc][enter]" `Execute `%{at}upper[%prog]` [Y/N] ?` %%ink
echo.
iff "%ink" eq "Y" .or. "%ink" eq
"{at}28" then
set i=%{at}inc[%i]
set run%i=%prog
set nextdate=%{at}date[%{at}eval[%{at}date[%today] + %when]]
set daysleft=%{at}date[%{at}eval[%{at}date[%nextdate] - %today]]
echo %{at}format[-41.41,%prog]³%{at}format[-5.5,%when]³%=
%{at}makedate[%today]³%{at}makedate[%nextdate]³%{at}format[-5.5,%daysleft]³%ask>>%temp
else
set nextrun=%{at}date[%{at}eval[%{at}date[%last] + %when]]
set daysleft=%{at}date[%{at}eval[%{at}date[%nextrun] - %today]]
echo %{at}format[-41.41,%prog]³%{at}format[-5.5,%when]³%=
%{at}format[-8.8,%last]³%{at}makedate[%nextrun]³%{at}format[-5.5,%daysleft]³%ask>>%temp
endiff
endiff
iff "%ask" eq "N" .or. "%ask" eq
"" then
set i=%{at}inc[%i]
set run%i=%prog
set nextdate=%{at}date[%{at}eval[%{at}date[%today] + %when]]
set daysleft=%{at}date[%{at}eval[%{at}date[%nextdate] - %today]]
echo %{at}format[-41.41,%prog]³%{at}format[-5.5,%when]³%=
%{at}makedate[%today]³%{at}makedate[%nextdate]³%{at}format[-5.5,%daysleft]³%ask>>%temp
endiff
elseiff "%prog" ne "" then
set nextrun=%{at}date[%{at}eval[%{at}date[%last] + %when]]
set daysleft=%{at}date[%{at}eval[%{at}date[%nextrun] - %today]]
echo %{at}format[-41.41,%prog]³%{at}format[-5.5,%when]³%=
%{at}format[-8.8,%last]³%{at}makedate[%nextrun]³%{at}format[-5.5,%daysleft]³%ask>>%temp
endiff
unset /q prog nextdate daysleft nextrun
enddo
move /q/u %temp %bootfile >& nul
iff "%i" ne "0" then
do m=1 to %i
echo. %+ echo.
color bri whi on whi
echos XBOOT3 Program Execution:
color bri cya on bla
echo %{at}upper[%[run%m]]
echo.
%[run%m]
{at}echo off
enddo
endiff
echo.
color bri red on whi
echos XBOOT3 END
color bri cya on bla
echo.
:END
color bri cya on bla
if exist %temp del /q %temp > nul
endlocal
color bri cya on bla
quit
:USAGE
color bri cya on bla
text
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ XBOOT3 ÄÄÄÄÄÄÄ Once a day program execution with many options ³
³ (selectable intervals, ask before execution). ³
³ For more info see the header of this file. ³
³ ³
³ XBOOT3.DAT is the data file XBOOT3.BTM, where ³
³ you can enter your progs and parameters. It ³
³ _must_ be in your path or the root dir of your ³
³ boot drive. ³
³ ³
³ XBOOT3 should be _called_ from autoexec.bat ³
³ ³
³ Syntax: XBOOT3 /? -? Syntax (this screen) ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
endtext
delay 5
goto END
=== Cut End: XBOOT3.BTM ===
For my sample data file....
=== Cut Begin: XBOOT3.DAT ===
PATH\PROGRAM TO RUN ³AFTER³ ³ ³DAYS ³
³ DAYS³LAST RUN³NEXT RUN³ LEFT³ASK
ÄÄÄÄ 001 ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÅMM-DD-YYÅMM-DD-YYÅÄÄÄÄÄÅÄÄÄ
call STEP_0.BTM ³1 ³10-31-02³00-00-00³0 ³N
call STEP_1.BTM ³1 ³10-31-02³00-00-00³0 ³N
call STEP_2.BTM ³14 ³10-19-02³00-00-00³0 ³N
call STEP_3.BTM ³28 ³10-26-02³00-00-00³0 ³N
call STEP_4.BTM ³7 ³10-26-02³00-00-00³0 ³N
call STEP_5.BTM ³2 ³10-30-02³00-00-00³0 ³N
call STEP_6.BTM ³3 ³10-30-02³00-00-00³0 ³N
call STEP_7.BTM ³4 ³10-30-02³00-00-00³0 ³N
=== Cut End: XBOOT3.DAT ===
I haven't bothered to convert all the high ASCII characters....
I'll include a sample TEST batch file (STEP_0.BTM) and you can copy it to
the other seven test files...
=== Cut Begin: STEP_0.BTM ===
echo. %+ echo This is %{at}upper[%{at}name[%_batchname]]. %+ echo.
touch /q %_batchname
=== Cut End: STEP_0.BTM ===
As usual, I'm not responsible for any damages.... :-)
Cheers ... Gerald
--- GoldED+/386 v1.1.5-21026
* Origin: An Oiler fan since the days they played outdoors. (1:342/512)SEEN-BY: 24/903 106/2000 120/544 123/500 140/1 342/5 512 400/300 633/104 260 SEEN-BY: 633/262 267 270 285 640/954 690/682 771/4020 774/605 2432/200 @PATH: 342/512 5 140/1 106/2000 123/500 774/605 633/260 285 267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.