Subj : XBOOT3.BTM To : Jasen Betts From : Gerald Miller Date : Mon Nov 04 2002 08:12 pm Hello Jasen, On Saturday November 02 2002 at 15:01, Jasen Betts [3:640/531.42] wrote to Gerald Miller, about: XBOOT3.BTM JB> here's what I did to it. JB> *** no changes before here *** JB> :: Next command establishes the location and name of the variable JB> :: "tempfile" that holds the tempfileorary information while the JB> :: action is performed. JB> set tempfile=%@unique[%temp] Agreed! :)) JB> :: User input JB> if [%1]==[-?] .or. [%1]==[/?] .or. [%1]==[?] goto USAGE JB> :: Is the file XBOOT3.DAT there? Where? JB> iff not exist %bootfile then JB> echo. JB> color bri red on whi JB> echo ERROR: %@path[%@search[%0]]%@name[%0].DAT not found! Because the above line presented an "unpleasant" color effect, I changed it to: echos ERROR: %@path[%@search[%0]]%@upper[%@name[%0]].DAT was not found! and I wanted to maintain uppercase for the filename... JB> color bri cya on bla JB> echo. JB> delay 5 JB> goto END JB> endiff JB> :: Set variables. If XBOOT3 did it's job today already or it's before JB> :: 00:01 am, do nothing. In this case, the "start" time is 00:01 JB> :: am.... JB> set lastdate=%@date[%@filedate[%bootfile]] JB> set today=%@date[%_date] JB> set dotime=00:01 set country=%_country The above line /*may*/ appear obvious, later... JB> if %@eval[%lastdate - %today] eq 0 .or. %@eval[%@time[%_time] - %= JB> %@time[%dotime]] le 0 goto END %@time[%dotime]] le 0 ( echo. color bri red on bri whi echos There is nothing to do today because it's all been done! color bri cya on bla echo. %+ echo. %+ delay 5 %+ goto END ) JB> :: Read XBOOT3.DAT, look at which progs to run today, copy info to JB> :: XBOOT3.TMP and update XBOOT3.DAT JB> set i=0 JB> echo. JB> set JB> df=%@replace[2,d,%@replace[20,yy,%@replace[1,m,%@makedate[14936]]]] JB> :: df is local date format. JB> text> %tempfile JB> PATH\PROGRAM TO RUN ³AFTER³ ³ ³DAYS JB> ³ JB> ³ DAYS³LAST RUN³NEXT RUN³ JB> LEFT³ASK JB> endtext JB> echo ÄÄÄÄ 001 echo ÄÄÄÄ %@format[3.3,%country] JB> %@repeat[Ä,32]ÅÄÄÄÄÄÅ%df%Å%df%ÅÄÄÄÄÄÅÄÄÄ >> %tempfile JB> set df= unset /q df JB> do n=3 to %@lines[%bootfile] JB> set prog=%@instr[0,41,%@line[%bootfile,%n]] JB> set when=%@instr[42,5,%@line[%bootfile,%n]] JB> set last=%@instr[48,8,%@line[%bootfile,%n]] JB> set next=%@instr[57,8,%@line[%bootfile,%n]] JB> set left=%@instr[66,5,%@line[%bootfile,%n]] JB> set ask=%@instr[72,1,%@line[%bootfile,%n]] JB> iff %@eval[%today-%@date[%last]] ge %when .and. "%prog" ne "" then JB> iff "%ask" eq "Y" then JB> beep 294 2 330 2 277 2 294 2 330 2 277 2 294 2 330 2 277 2 294 JB> 2 JB> beep 330 2 0 2 139 2 165 2 196 2 233 2 277 2 466 2 554 2 659 2 JB> beep 784 2 932 2 JB> scrput %_row %@eval[17+%@len[%prog]] bri yel on bla `Y` JB> inkey /c/K"YN[esc][enter]" `Execute `%@upper[%prog]` [Y/N] ?` JB> %%ink JB> echo. JB> iff "%ink" eq "Y" .or. "%ink" eq "@28" then JB> set i=%@inc[%i] JB> set run%i=%prog JB> set last=%@makedate[%today] JB> endiff JB> elseiff "%ask" eq "N" .or. "%ask" eq "" then JB> set i=%@inc[%i] JB> set run%i=%prog JB> set last=%@makedate[%today] JB> endiff JB> elseiff "%prog" == "" then JB> iterate JB> endiff JB> set nextdate=%@eval[%@date[%last]+%when] JB> set daysleft=%@eval[%nextdate - %today] JB> echo JB> %@format[-41.41,%prog]³%@format[-5.5,%when]³%@format[-8.8,%last %= JB> ]³%@makedate[%nextdate]³%@format[-5.5,%daysleft]³%ask>>%tempfile JB> unset /q prog daysleft nextdate JB> enddo JB> unset /q next, The above has me a little baffled. Why the comma and why not place it on the line before ENDDO? NEXT what? JB> move /q/u %tempfile %bootfile >& nul JB> iff "%i" ne "0" then JB> do m=1 to %i JB> echo. %+ echo. JB> color bri whi on whi JB> echos XBOOT3 Program Execution: JB> color bri cya on bla JB> echo %@upper[%[run%m]] JB> echo. JB> call %[run%m] If I am putting a CALL (before all the batch file names) in the DAT file, does it not translate to "call call batchame"? Or is one of the redundant CALLs ignored? JB> @echo off JB> enddo JB> endiff JB> echo. JB> color bri red on whi JB> echos XBOOT3 END JB> color bri cya on bla JB> echo. JB> :END JB> color bri cya on bla JB> if exist %tempfile del /q %tempfile > nul JB> endlocal JB> color bri cya on bla JB> quit JB> *** no changes after here *** On the whole, I am very pleased with your input. I had "hit" upon the use of the %@repeat[char[196],4] command when I had mentioned XBOOT32.BTM, but I wanted to give you some time to digest what I had previously posted. My notion of putting the %_country command near the beginning is because I am planning to implement a check/change routine after the %_country command. If the country code of the system running the batch does not match the country code within the data file, then convert all the dates within the data file to the correct format of that country. It is a PITA to keep changing the COUNTRY.SYS line and rebooting the computer. Ideally, I should have a second computer for the test country.... Cheers ... Gerald --- GoldED+/386 v1.1.5-21026 * Origin: If it ain't broke, don't fix it. (1:342/512) .