Dec 052017
 
A simple program that counts the number of times it has been invoked. For use in batch files.

Full Description of File


RunCounT simply keeps track of the number of
times it is invoked and stores that
information in its own log file. It checks
that log file each time it is run. If the
number of times it has been run reaches the
first number specified on the RunCounT
command line, the record log file is deleted
and RunCounT places the second number found
on the command line in memory as an
errorlevel. Dos can then interpret this
value via the batch program language. This in
turn can allow the OS to react accordingly.


File RUNCOUNT.ZIP from The Programmer’s Corner in
Category Batch Files
A simple program that counts the number of times it has been invoked. For use in batch files.
File Name File Size Zip Size Zip Type
FILE_ID.DIZ 519 296 deflated
RUNCOUNT.DOC 6155 2478 deflated
RUNCOUNT.EXE 10847 10467 deflated

Download File RUNCOUNT.ZIP Here

Contents of the RUNCOUNT.DOC file


RunCounT - Count and errorlevel exit utility - Glen Gilbert 1:157/534

RunCounT version 0.0 11-30-1993

What:

RunCounT [RCT_log] 5 99

RunCounT simply keeps track of the number of times it is invoked and
stores that information in its own log file. It checks that log file
each time it is run. If the number of times it has been run reaches
the first number specified on the RunCounT command line, the record
log file is deleted and RunCounT places the second number found on
the command line in memory as an errorlevel. Dos can then interpret
this value via the batch program language. This in turn can allow
the OS to react accordingly. See the examples below...

Why:

By running RunCounT from a batch file you can operate a utility
after so many iterations. One application is for purging or packing
a message base such as invoking Squish's sqpack. Another is the
periodic running of an echo or file area manager such as seal. You
can run RunCounT from your autoexec.bat to optimize your drive
after so many reboots, etc..

How, when and where:

Syntax: RunCounT 5 99 /q /f

Creates a default file named COUNT.RCT if no count file name is
specified and it is run in the current directory. The /f will
have RunCounT create the minimum size log file for disk space and
speed conservation. The number 5 allows RunCounT to be invoked 5
times before deleting the COUNT.RCT and exiting with an errorlevel
of 99. No screen output will be produced because of the /q switch.

The only command line arguments required are the 1st and 2nd numbers
(execution limit) and (errorlevel exit value) in that order.

* Type RunCounT all by itself to see a full description of usage.

Example: Purge or pack your squish message base(s) from a batch file.

:tos
squish in out squash
RunCounT msgpak 10 1
if errorlevel 1 sqpack \bt\msg\*.sqd

Example: Run Echo area manager

:seal
RunCounT 5 1
if errorlevel 1 goto do_seal_stuff
goto do_other_stuff

:do_seal_stuff
SEAL BAD
SEAL DESCRIBE ECHO C:\BT\FIDONET.NA
SEAL SCAN
Squish in out squash

:do_other_stuff
echo CONTINUING PROCESS:::

Note: these are only cuts and not a complete batch file. This
example is for an electronic mail process, the aftermail batch file
would likely contain many commands. These snips assume you would tell
your batch file to jump to the label :tos and :seal after mail has
been received etc..

RunCounT can operate several functions by giving it different count
record log names. The potential to use RunCounT in two different ways
from the same batch file is shown below. Applications are not limited
as long as you do not run out of record log names.

RunCounT sq_poll 20 99
if errorlevel 99 squish poll 8:100/0
RunCounT mspgpak 10 98
if errorlevel 98 sqpack c:\bt\msg\*.sqd

Note: Always test errorlevels in descending order.

RunCounT sq_poll 20 99
if errorlevel 99 goto do_this
if errorlevel 98 goto do_that

Limits:

Significant errorlevels 1 - 255
Execution limits 2 - 4,294,967,295

Minimum values: RunCounT 2 1
Maximum values: RunCounT 4294967295 255

Control:

/q -q QUIET Mode (no screen output)
/f -f FastMode (minimum record logging)

Using the F switch

D:\MAX> RunCounT maint 300 99 /f

RunCounT - Count and exit with errorlevel - Glen Gilbert

FastMode no-log: ON
CountRecrd File: maint.rct
Execution Limit: 300
Exit errorlevel: 99
Open RecordFile: maint.rct
Storing Count #: 1

RunCounT keeps a log of its own operation in order to determine
when it is time to exit with the specific errorlevel. This log
will always be deleted on the final execution. However it grows
quite large when RunCounT is given a high execution limit. The
log will look something like this.

1 Nov 29 14:20:13 1993
2 Nov 29 14:20:15 1993
3 Nov 29 14:20:16 1993
4 Nov 29 14:20:16 1993
5 Nov 29 14:20:17 1993

With an execution limit of 300 this log will eventually contain
299 entries before it is deleted. Not only does this take up disk
space, the speed of RunCounT diminishes as the log grows. To avoid
this, use the /f (fastmode) switch. Only the current execution
value and timestamp will be contained in the log rather than the
previous ones. The reason for accumulating execution numbers and
timestamp information (the default) is for operation analysis. You
may view the log anytime before the execution limit and subsequent
dos errorlevel exit.



RunCounT is free but it is not to be packaged with other software
without the author's consent. Nor may other software be packaged
with RunCounT. If it is to be distributed, the archive must contain
this document (RunCounT.doc) and original unaltered executable.

Use RunCounT at your own risk. The author takes NO responsibility
for any possible damage which could occur due to its use. If you
are skeptical about the safety of using this program and do not
wish to take precautionary measures to insure RunCounT will do no
damage, then do not use it.

Acknowledgement, comments and suggestions of a constructive
nature are appreciated. Please send them to:

Who:

Glen Gilbert 8:1006/[email protected]
1:157/[email protected] (216)628-4860 data/fax

Thanks Chris Mann 1:157/[email protected]
8:1006/[email protected]
100:1/[email protected]



 December 5, 2017  Add comments

Leave a Reply