home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 3 Comm
/
03-Comm.zip
/
once.txt
< prev
next >
Wrap
Text File
|
1994-10-29
|
4KB
|
109 lines
The following was posted in answer to a question about starting GCP once a
day, everyday the first time and only the first time your computer boots up.
I wrote a little REXX command file that checks the OS2.INI file for today's
date. If it doesn't find today's date, it returns an ERRORLEVEL of 0 and
runs GCP and then writes today's date to the OS2.INI file. If it runs a
second time, it will find today's date, return an ERRORLEVEL of 1 and skips
over the GCP stuff. I have this in the Startup.cmd as follows:
startup.cmd:
.....beginning lines...
CALL ONETIME.CMD
IF ERRORLEVEL = 1 GOTO ENDIT
E:
CD\GCP
IF EXIST C:\DNL\CURWEATH.GIF ERASE C:\DNL\CURWEATH.GIF
rem I don't want a "file already exists" error...
@ECHO MAP 3,1,9 > G:\GCPMSG\WEATHER.SND
rem build a "Weather.snd" object each day to download a weather map...
COMMPASS /PARAMS=CIS /CMD=N
:ENDIT
EXIT
...end of the Startup.cmd file....
The Rexx code I call ONETIME.CMD:
/**** File will set the errorlevel to 1 if run a second time *****/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
w = SysIni(, 'Onetime', 'Date') /* Read date from OS2.INI */
if w = date() then /* if 'read' date matches today...*/
r = 1 /* set return to 1 */
else
r = 0 /* or else set return to 0 */
call SysIni, 'Onetime', 'Date', date() /* write today's date to */
/* os2.ini file */
Exit r; /* return the appropriate errorlevel to startup.cmd...*/
Remember that a REXX program MUST start with a "comment" as it's first
line (/* ... */) to distinguish it from a plain *.cmd file. See the REXX.INF
file in your \OS2\BOOK subdirectory for more info.
The above code puts an entry called "Onetime" in the OS2.INI file with
a DATE as the stored data.
I also like to download a current weather map but I can't figure out how to
get GCP to do that automatically each day so I build "WEATHER.SND" file
each day from the startup.cmd.
I also download catalogs of the new files from the past 8 days each Saturday
and from different forums then I visit daily. I wrote another REXX cmd file
to check for Saturday and if it is Saturday, to run GCP with a different
/param= file. I have built a bunch of FORUM.DOW files where "FORUM" equals
the appropriate name of each forum. I store these *.DOW files in a zip file
called GCPDOWN.ZIP and then on Sat. I unzip them to the GCPMSG subdirectory.
The GCPSUPPO.DOW file looks like:
XA1
DIR LONG DES AGE:8 LIB:ALL
You can change the "LIB:" to 1,3,6 etc as appropriate... Some forums use
LIB 0 and some use LIB 1 as the first LIB so the first line should be a
valid library number for that forum.
I call this file Saturday.cmd and here is how it works.
/**** File will set the errorlevel to 1 if run on Saturday *****/
call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
call SysLoadFuncs
if Date('w') = "Saturday" then /* If its Saturday, then... */
Do
r = 1 /* set return code to 1 */
"%RDRV%:" /* Change to my Ram Drive where I keep all my small files */
"CD\bat" /* Change to the appropriate sub directory */
"unzip gcpdown -d G:\gcpmsg\" /* unzip the *.DOW files */
"E:"
"cd\GCP"
COMMPASS "/params=SAT /cmd=N" /* Start GCP with the "Saturday" param */
/* file */
end
else do /* Or else return a 0 */
r = 0
end
Exit r; /* return the appropriate errorlevel to startup.cmd...*/
The Startup.cmd with this code looks like:
startup.cmd
.....beginning lines...
CALL ONETIME.CMD
IF ERRORLEVEL = 1 GOTO ENDIT
E:
CD\GCP
IF EXIST C:\DNL\CURWEATH.GIF ERASE C:\DNL\CURWEATH.GIF
@ECHO MAP 3,1,9 > G:\GCPMSG\WEATHER.SND
CALL SATURDAY.CMD
IF ERRORLEVEL = 1 GOTO ENDIT
rem If Saturday.cmd returns a 1 then it already called CI$ and we can
rem skip doing it a second time...
COMMPASS /PARAMS=CIS /CMD=N
:ENDIT
EXIT
Hope this helps... any questions? Tom Gallaudet 72206,2464