These messages were never sent, just answered and saved. I did not have the
documentation for M.EXE ready.  It still needs a lot of work,  but with all
of these examples, M.EXE should be easier to use.

Gary Mays

For M401B2.ZIP,  any messages using old removed features have been
removed.  Many of the batch files from these messages exist  as  a
separate .bat file enclosed in the distribution archive.

---------------------------------------------------------------------------

Area : BatPower Saved Messages

Date : Jul 29 '95, 22:34                                                Loc
From : Gary Mays                                              1:261/1191
To   : Craig Yerdon
Subj : Do task once a week


@MSGID: 1:261/1191.0 1ad8a03
@REPLY: 1:147/49.0 2fed849a
Quoting Craig Yerdon (Sun 25 Jun 1995 10:45) to All:

 CY> Hello Everyone,
 CY> I was wondering if anyone can help me.
 CY> I administer several offices full of networked PCs. I
 CY> thought it would be useful to be able to do tasks from
 CY> AUTOEXEC.BAT only on certain days of the week. (or better
 CY> still, certain days of the month) 
 CY> Does anyone know the batch command line to do something like
 CY> that? For example, run "DEFRAG C: /F" at bootup on Monday
 CY> mornings.
 CY> Thanks in advance!
 CY> -=Craig

 CY> ___ Maximus 2.01wb
 CY>  - Origin: Fort Knox Data Center (1:147/49)
:: perform daily tasks
  m/set day=[day$(1,3)] 
  goto %day%
:mon
  m/set a=[getfage:c:\misc\defrag.log]
  if %a%==0 goto fin
  :: defrag here
  m [date] [time] Defragged.>>c:\misc\defrag.log
  goto fin
:tue
:wed
:thu
:fri
:sat
:sun
:fin
::
:: perform monthly tasks
  m/set d=[dd]
:: for a lot of different days do
::    goto day_%d%
:: and have a label for each day
:: for a few days do
::    if %d%==05 goto 05
  if %d%==25 goto 25
  goto fin2
:25
  :: perform tasks for 25th of month
  m/set a=[getfage:c:\misc\day.%d%]
  if %a%==0 goto fin2
  :: do whatever here
  echo. >c:\misc\day.%d%
:fin2


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 09 '95, 03:03                                                Loc
From : Gary Mays                                              1:261/1191
To   : David Emerling
Subj : file naming


@MSGID: 1:261/1191.0 2853a1b
@REPLY: 1:123/71 54cf7812
Quoting David Emerling (Thu 02 Feb 1995 13:13) to All:

DE> * Copied (from: BATPOWER) by Gary Mays using timEd/2 1.01.

DE> Can anybody suggest a batch file routine that will rename a
DE> text file to the current date?

DE> i.e.  Rename TEXTFILE.TXT to 03-18-95.TXT

m/xqt rename textfile.txt [mm]-[dd]-[yy].txt
  or
m/xqt rename textfile.txt [yyyymmdd].txt
  or
m/xqt rename textfile.txt [yymmdd].txt

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 06:11                                                Loc
From : Gary Mays                                              1:261/1191
To   : Shawn Oatley
Subj : Compare


@MSGID: 1:261/1191.0 298c79c
@REPLY: 2:243/6151.21@fidonet 1114df4a
Commenting on: Ingo Kley (Fri 03 Feb 1995 21:14) to Shawn Oatley:

IK> @MSGID: 2:243/6151.21@fidonet 1114df4a
IK> * Copied (from: BATPOWER) by Gary Mays using timEd/2 1.01.

 > Is there any way to take a file, and compare it to another file.  I want
 > to be able to check the dates and if they are different, exit with an
 > errorlevel or something.  Will DOS' COMP do it?
Using my M.EXE:

 m/set d1=[getfdate`file1]
 m/set d2=[getfdate`file2]
 if not %d1%==%d2% goto fin
 echo Files are the same date
 :fin

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 09 '95, 03:11                                                Loc
From : Gary Mays                                              1:261/1191
To   : Joe Kron
Subj : Selecting a line from


@MSGID: 1:261/1191.0 2853a1d

JK> echo %1
JK> echo find %"%"%1"% test >test1.bat 
JK> call test1.bat 
JK> rem How can you get the 2nd line of output of TEST1.BAT into an 
JK> EVAR?
m/set x=[@test1.bat`2]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 14:07                                                Loc
From : Gary Mays                                              1:261/1191
To   : Steven Lochridge
Subj : Picking and choosing


@MSGID: 1:261/1191.0 34d4602
Quoting Steven Lochridge (Sat 04 Feb 1995 07:20) to All:

SL> * Copied (from: BATPOWER) by Gary Mays using timEd/2 1.01.

SL> I'm looking for some sort of way of grabbing certain
SL> information from a text file that only has 1 word or set of
SL> numbers per line and storing it in the environment.  For
SL> example:
SL>  
SL> DATAFILE.TXT -
SL>  
SL> George
SL> 10
SL> 1000
SL> Y
SL> N
SL> 38400
SL> wordup
SL> 25
SL>  
SL> <eof>
SL>  
SL> Now, how could I grab, say, the "1000" and/or the "wordup"
SL> and use it later in a batch file.
SL>  

 m/set a=[@datafile.txt`3]
 m/set b=[@datafile.txt`8]

  or, the first eight lines into environment variables:

:: set f1 - f8 with the 1st 8 lines of DATAFILE.TXT
 set n=1
 m/set/i8 f[n++]=[]<datafile.txt


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 19 '95, 00:24                                                Loc
From : Gary Mays                                              1:261/1191
To   : Siobhan Burke
Subj : Resetting Time


@MSGID: 1:261/1191.0 35689a0
@REPLY: 1:251/29 87AE0B1F
Quoting Siobhan Burke (Sat 04 Feb 1995 13:24) to All:


SB> I've been trying to write a batch file that would check the
SB> day of the week ie. Friday and would then run an event that
SB> would put the DOS time into the environment, add 1 minute

Using my M.EXE and SETCLK.EXE:

 m/set d=[day$]
 if not %d%==Friday goto fin
 m/set d=[getfage`c:\setclk.log]
 if %d%==0 goto fin
 setclk /a60
 m Fri [date] [time]>>c:\setclk.log
 :fin

    or

 :: assume 9 seconds of loss per day
 if not exist setclk.log goto flag
 :exist
 m/set d=[getfage`c:\setclk.log]
 if %d%==0 goto fin
 m/set d=[%d%`mul`9]
 m/xqt setclk /a%d%
 :flag
 m [day3$] [date] [time] %d% seconds>>c:\setclk.log
 :fin

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:42                                                Loc
From : Gary Mays                                              1:261/1191
To   : Jeff Gulley
Subj : Basic date help


@MSGID: 1:261/1191.0 298c79b
@REPLY: 2:255/100.0 2fc91ab6

 JG> Just wondered if there was a way to use a batch file to
 JG> take a file, foo.dat, and rename it using the julian date
 JG> as part of the file name?  It probably is pretty simple,
 JG> but I have yet to figure out how to do it.

set f=filename.ext
if not exist %1 goto nofile

:: xyz.ext to xyz###.ext
m/xqt rename %1 [ss`[fonly`%1]`1`5)][julian].*
     or
:: xyz.ext to xyz.###
m/xqt rename %1 [fonly`%1].[julian]
     or
:: xyz.ext to yyyyjjj.ext
m/xqt rename %1 [yyyy][julian].[ftype`%1]

:nofile


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 09 '95, 04:02                                                Loc
From : Gary Mays                                              1:261/1191
To   : Steve Toft
Subj : extensions


@MSGID: 1:261/1191.0 2853a23
@REPLY: 1:130/205 2fe32041
Quoting Steve Toft (Sat 17 Jun 1995 18:30) to All:

ST> Could someone please point out to me how to rename my file
ST> extensions to the Julian date.  Such as having my batch
ST> automatically rename my daily backup from backup.arj to

m/xqt rename backup.arj backup.[julian]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:39                                                Loc
From : Gary Mays                                              1:261/1191
To   : Per Kristensen
Subj : Errorlevel based on date


@MSGID: 1:261/1191.0 298c79a
@REPLY: 2:236/43.43 2fde887a
Quoting Per Kristensen (Wed 14 Jun 1995 06:56) to All:

........
PK> Hope the above explains what I want: A certain program to be
PK> run once every 3 weeks (21 days).

Using my M.EXE:

 @echo off
 :: will call a program each nth day referenced to a particular date
 :: ****** set d=mm/dd/yy of reference date
 set d=3/21/44
 :: ****** set n=nth day
 set n=21
 :: set t to days since 1/1/1900
   m/set t=[pdate`today]
 :: set f=(today-refdate) mod n
   m/set f=[[%t%`sub`[pdate`%d%]]`mod`%n%]
 :: always check if called already when today is the nth day
   if %f%==0 goto testit
 :: now check if last nth day was performed by adjusting
 :: the packed date down by value of days past last date
   m/set t=[%t%`sub`%f%]
 :testit
 :: skip program if log file date is >= operation date
 :: t has pdate of operation
 :: set p to pdate of file
   if not exist nthday.log goto doit
   m/set f=[[pdate`[getfdate`nthday.log]]`ge`%t%]
   if %f%==F goto doit
   m Already performed operation for [day3$`%t%] [date`%t%]
   goto not
 :doit
 :: notify when date used is not today
   m/xqt/q if not %t%==[pdate`today] m Making up missed operation for
[day3$`%t%] [date`%t%]
 :: ****** call your program here **use CALL if it is a batch file!**
   echo called program.bat
 :: update log file to prevent calling program more than once for nth day
   if exist nthday.log goto logit
   echo ***Do not edit this file or change the date of this file. This file is
the>nthday.log
   echo ***NTHDAY.LOG of nth day operations referenced to %d% for each %n%
days>>nthday.log
   echo ***Changing the date will affect the correct operation of
NTHDAY.BAT>>NTHDAY.LOG
 :logit
   m [day$`%t%] [date`%t%] performed on [day3$] [date] at
[time]>>NTHDAY.LOG
   echo Updated log file NTHDAY.LOG
   type nthday.log
 :not
   set n=
   set d=
   set f=
   set t=


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 09 '95, 04:07                                                Loc
From : Gary Mays                                              1:261/1191
To   : Jeff Martin
Subj : String to env. variable

@MSGID: 1:261/1191.0 2853a25
@REPLY: 1:135/813@FIDOnet 00002165
Quoting Jeff Martin (Thu 15 Jun 1995 14:07) to ALL:

JM>     Does anyone know how to make, or where to get a batch
JM> enhancer     that will get a user's input and place it into
JM> an environment     variable?
JM>     eg.
JM>             Enter selection?> TEXTFILE.TXT
JM>     Result
JM>             sel=TEXTFILE.TXT
...........
m/set sel=[?Enter filename]
:: errorlevel 5 is set when Esc is pressed

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:38                                                Loc
From : Gary Mays                                              1:261/1191
To   : Joe Morris
Subj : Random Numbers?


@MSGID: 1:261/1191.0 298c799
@REPLY: 1:352/256 5497224b
Quoting Joe Morris (Sat 17 Jun 1995 22:38) to All:

JM>     Is there a way to generate Random Numbers via a BAT
JM> file?  I kinda doubt  it, but if anyone has I would love to
Using my M.EXE:

m [random`n]
  where n is 1..65535 and the result is 0..n-1

:: set r to a four digit random number
m/set r=[random`10][random`10][random`10][random`10]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:37                                                Loc
From : Gary Mays                                              1:261/1191
To   : Per Kristensen
Subj : Erase specific files


@MSGID: 1:261/1191.0 298c798
@REPLY: 2:236/43.43 2fdf4c71
Quoting Per Kristensen (Wed 14 Jun 1995 20:48) to All:

PK> If the file 0000000x.txt exists (x being any letter from
PK> a..z) then the file 0000000.txt should be erased if it
PK> exists.
<snip>
PK> The 0000000 part of the file name is just an example, the
PK> file name varies.
Using my M.EXE:

  if not %1'==' goto self
  for %%xx in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do call %0
%%xx
  goto fin
  :self
  if not exist ???????%1.txt goto fin
  dir ???????%1.txt /b | m/xqt if exist [ss`[]`1`7].txt echo erasing
[ss`[]`1`7].txt
  :fin


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 09 '95, 04:46                                                Loc
From : Gary Mays                                              1:261/1191
To   : Jason Tedor
Subj : Need Input routine


@MSGID: 1:261/1191.0 2853a28
@REPLY: 1:355/2.1011 d5b5e714
Quoting Jason Tedor (Tue 20 Jun 1995 19:25) to All:

JT> input. But now I need a utility or method that will allow
JT> user input to be piped to the environment, but of a set
JT> length. I don't want the user to be able to type anymore
JT> than x characters.
:: set x to the first 10 characters of user input
m/set x=[ss`[?Info]`1`10]


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 10 '95, 05:57                                                Loc
From : Gary Mays                                              1:261/1191
To   : Gary Snyder
Subj : month call?


@MSGID: 1:261/1191.0 52ae993
@REPLY: 1:301/36.0 2ffa193e
Quoting Gary Snyder (Tue 04 Jul 1995 22:46) to All:

GS> Does anyone have a batch file (or debug script) to get the
GS> month? 
With my M.EXE:

 :: January..December
 m/set d=[month$]
 :: Jan..Dec
 m/set d=[month3$]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:35                                                Loc
From : Gary Mays                                              1:261/1191
To   : Kramer
Subj : Bat to delete older file?


@MSGID: 1:261/1191.0 298c796
Quoting Kramer (Mon 03 Jul 1995 13:25) to All:

K> Can anyone tell me if there is a simple way of testing for
K> the older of say 2 files (with very similar file names),
K> then deleting the older one? 

K> Ex:  You have 2 files in a dir:
K>                                 nodelist.167   06/15/95
K>                                 nodelist.175   06/30/95

K> I need a bat file that will recognize the older of these 2
K> files and then delete it?

Using my M.EXE:

:: identify this weeks nodelist
m This weeks nodelist is NODELIST.[julianwk`fri`0]

:: erase last weeks nodelist when this weeks nodelist is here
m/xqt if exist nodelist.[julianwk`fri`0] erase nodelist.[julianwk`fri`-1]

:: test if nodelist is current
  m/set x=[ufn`nodelist.[julianwk`fri`0]]
  if %x%==T goto current
:: test if nodediff is present and last weeks nodelist is present
  m/set x=[ufn`nodediff.[julianwk`fri`0]][ufn`nodelist.[julianwk`fri`-1]
  if %x%==TT goto updatenl
:: if monday is here and nl is not present, then generate freq
  m/set x=[day3$]
  if %x%==Mon call freqnl
  if %x%==Tue call freqnl
  goto skip
:updatenl
  call updatenl
  erase nodelist.[julianwk`fri`-1]
  erase nodediff.[julianwk`fri`0]
:skip
:current

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 10 '95, 05:32                                                Loc
From : Gary Mays                                              1:261/1191
To   : Dennis O'connor
Subj : Execute App after X Da


@MSGID: 1:261/1191.0 298c795
@REPLY: 1:202/1309 884917EC
Quoting Dennis O'connor (Tue 11 Jul 1995 17:07) to All:

DO> I would like to include a batch routine in my autoexec.bat
DO> with the following features:

DO>           1.       Track the total number of days since last
DO> execution                    of an application.

DO>           2.       Execute an application after X days have
DO> passed. 

DO>           3.       Execute that application only once on a
DO> given day                    after X days have passed.

Using my M.EXE:

14THDAY.BAT
 @echo off
 :: run program once each 14 days
 :start
 :: set a to age of log file
 m/set a=[getfage`c:\program.log]
 :: if file does not exist then will get -1 for the file age
 if %a%==-1 goto new
 :: check if age is greater or equal to 14 days
 m/set p=[%a%`ge`14]
 if %p%==T goto run
 echo PROGRAM was run %a% days ago.
 goto fin
 :new
 echo This is the first time PROGRAM has been run.
 set a=0
 :run
 echo Running PROGRAM after %a% days.
 :: PROGRAM
 :: log the execution date and time
 m [date] [time] PROGRAM was run after %a% days.>>c:\program.log
 :fin


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 10 '95, 05:49                                                Loc
From : Gary Mays                                              1:261/1191
To   : Tony Baechler
Subj : Triming characters


@MSGID: 1:261/1191.0 52ae992
@REPLY: 1:202/1207.4 30185617
Quoting Tony Baechler (Thu 27 Jul 1995 13:19) to All:

TB> Hello, I have a file with some lines in it.  I would like to
TB> trim everything to the right of a certain character, the "="
TB> character.  For example:

TB> Marker#9_Line_Position = 1
TB> Window#J_Third_Command = Undefined

TB> These two lines would become:

TB> Marker#9_Line_Position
TB> Window#J_Third_Command
Using my macro processor M.EXE:

TRIM.BAT
:: trim everything to the right of =
m/set f=[promptgetfile`Enter file to trim to right of =`]
if %f%'==' goto fin
m/set g=[fonly`%f%].trm
m [parse`=`[]``nul]<%f%>%g%
echo The output is in %g%
:fin
set f=
set g=

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 10 '95, 05:45                                                Loc
From : Gary Mays                                              1:261/1191
To   : Otto Lang
Subj : Help with batch file


@MSGID: 1:261/1191.0 52ae991
@REPLY: 1:250/228.0 30298440
Quoting Otto Lang (Thu 10 Aug 1995 00:00) to All:

OL> I am writing a batch file which will, with or without a
OL> parm, copy all files in a specific subdirectory of WP51 AND
OL> of a
OL> a particular date stamp to a diskette.
OL> For example
OL>     Current
OL> will copy all files in C:\WP51\FREE with today's system date
OL> to A: while
OL>     Current 08-08-95
OL> will copy all those files in C:\WP51\FREE with a file date
OL> of 08-08-95 to A:
Using my M.EXE:

@echo off
:: %1 can be a date as mm/dd/yy
  c:
  cd \wp51\free
  if %1'==' goto nodate
  m/set p=[pdate`%1]
  if errorlevel 1 goto fin
  goto copy
:nodate
  m/set p=[pdate`today]
:copy
  dir /-p/a-d/b | m/xqt/q if [pdate`[getfdate`[]]]==%p% copy [] a:
:fin



Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 12 '95, 15:16                                                Loc
From : Gary Mays                                              1:261/1191
To   : Chris Wiesner
Subj : FILENAME PARSING


@MSGID: 1:261/1191.0 2cf5984
@REPLY: 1:243/23.0 02928ef0
Quoting Chris Wiesner (Wed 09 Aug 1995 13:19) to All:

CW> I'm wondering if anyone has come up with a way to parse
CW> filenames and extensions. I'm trying to convert
CW> subdirectories on the fly from .xxx to .yyy, however using
CW> DOS  FOR %%a in (*.xxx) do ... always provides the complete
CW> filename. I'm looking for a way to strip the extension.
CW> Speed is not an issue.
Using my M.EXE:

dir *.xxx /ad | m/xqt/q rename [fonly`[]].yyy

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 13 '95, 06:18                                                Loc
From : Gary Mays                                              1:261/1191
To   : Greg Schlagel
Subj : Filesizes


@MSGID: 1:261/1191.0 2dba627
@REPLY: 1:2245/105.0 302ad0ef
Quoting Greg Schlagel (Thu 10 Aug 1995 23:39) to All:

GS> I would like to perform something like this..
GS> (using improper syntax to demonstrate, of couse :)

GS> if filename.ext size > 100000 then do this (or goto a label)

GS> It would be best for my need if the filename.ext would
GS> handle wildcard, and somehow the sizes got added together
GS> before the size > xxxxx comparison.
Here is a batch file using my M.EXE:

FSIZE.BAT
set t=0
set n=0
:: accumulate total file size of all bat files
dir *.bat /b /-p /a-d | m/set t=[[env`t]`add`[getfsize`[]][nul`[n++]]
echo There are %n% *.bat file(s) using %t% bytes.
m/set x=[%t%`gt`100000]
if %x%==T goto fgreater

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 16 '95, 03:31                                                Loc
From : Gary Mays                                              1:261/1191
To   : Agnes Leung
Subj : Any hints?


@MSGID: 1:261/1191.0 31919b2
@REPLY: 1:134/49.0 302e25d0
Quoting Agnes Leung (Sat 12 Aug 1995 11:28) to All:

AL>   I want to create a batch file so that I can delete
AL> everything but certain files within a directory.  For
AL> example, if I have 10 ZIP files and 20 other files with 20
AL> different extensions, and I want to keep the ZIP files, how
AL> should I go about writing a batch file that will do this?
Using my M.EXE:

@dir /b/a-d/-p | m/xqt/q if not [ftype`[]]!==ZIP! echo erasing []

Just change 'echo erasing' to 'erase' after you are confident that
it works.

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 13:31                                                Loc
From : Gary Mays                                              1:261/1191
To   : Micheal Ly
Subj : question on password


@MSGID: 1:261/1191.0 34d4600
@REPLY: 1:134/49.0 3031713a
Quoting Micheal Ly (Tue 15 Aug 1995 23:16) to All:

ML>         Well I wanted to setup up a password in a bat file.

With my M.EXE:

  @echo off
:: prompt for password and convert it to upper case
  m/set m=[ucase`[?^Huh?]]
  if not %m%'==SECRET' goto abort
  echo DoIt!
:abort


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 14:10                                                Loc
From : Gary Mays                                              1:261/1191
To   : Per Kristensen
Subj : Test on file size


@MSGID: 1:261/1191.0 34d4603
@REPLY: 2:236/43.43 3016d698
Quoting Per Kristensen (Wed 26 Jul 1995 23:57) to All:

PK> I need to check on a files size, e.g.

PK> "If filename.ext > 50 bytes then do_something"

m/set s=[[getfsize`filename.ext]`gt`50]
if %s%==F goto abort


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 14:16                                                Loc
From : Gary Mays                                              1:261/1191
To   : Brian Hudson
Subj : New Guy needs HELP


@MSGID: 1:261/1191.0 34d4604
@REPLY: 1:3625/441.0 2f32e090
Quoting Brian Hudson (Sat 04 Feb 1995 02:04) to All:

BH> Basically, I would like to "selectively" backup the
BH> directories on my D: drive (fixed hard disk) using PkZip and
BH> place the zip file in my c:\backup directory (for example,
BH> pkzip c:\backup\windows.zip d:\windows\*.* -rP -a+).  What I
BH> mean by "selectively" is that I'd like to be asked and then
BH> select whether or not each directory is Zipped or not, and
........
BH> D:\DOS (y,n)
BH> D:\UTILS (y,n)
BH> D:\WINDOWS (y,n)

@echo off
:: run zipped backup for directories named in DIRS.TXT
  rem>%temp%\back.bat
  m if [menu`Backup []?`Yes`No]'==Y' pkzip -rP -a+ c:\backup\[fonly`[]]
[]<dirs.txt>>%temp%\back.bat
  %temp%\back.bat

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 15:06                                                Loc
From : Gary Mays                                              1:261/1191
To   : Nelson Tamayo
Subj : HELP! :)


@MSGID: 1:261/1191.0 34d4605
@REPLY: 1:377/49 55835678
Quoting Nelson Tamayo (Sun 18 Jun 1995 23:38) to All:

NT> I am trying to make a batch file that will place a zip
NT> comment in all my zip files, i want it to read a
NT> configuration file, and in the configuration file i want it

 @ECHO OFF
 :: Update .ZIP Comments Using Configured Directories
 :: Create  a  configuration  file  ZIPCOM.CFG  with  a  list of
 :: directory names to get all .ZIP file comments updated. Don't
 :: use a trailing directory indicator. Use a blank line or just
 :: the disk drive indicator to specify the root directory.  Now
 :: create  a  zip  comment  file  named ZIPCOM.TXT and run this
 :: batch file.
   m/xqt "for %%x in ([]\*.zip) do pkzip -z %%x <zipcom.txt"<zipcom.cfg

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 18 '95, 15:11                                                Loc
From : Gary Mays                                              1:261/1191
To   : Craig Yerdon
Subj : Question


@MSGID: 1:261/1191.0 34d4606
@REPLY: 1:147/104 55af0872
Quoting Craig Yerdon (Sat 22 Jul 1995 03:05) to All:

CY> Can someone suggest a way to do the task on the chosen day
CY> and only ONCE that day?

  :: attempt to perform task on the 1st and the 15th of the month
  m/set d=[day]
  if %d%==1 goto dotask
  if %d%==15 goto dotask
  goto fin
  :dotask
  :: set a to age in days of the task.log
  m/set a=[getfage`task.log]
  if %a%==0 goto not
  echo Doing task for 1st or 15th
  echo>task.log
  :not
  :fin
  set d=
  set a=

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 24 '95, 00:18                                                Loc
From : Gary Mays                                              1:261/1191
To   : Per Kristensen
Subj : Log information


@MSGID: 1:261/1191.0 3bfeb40
@REPLY: 2:236/43.43 30331949
Quoting Per Kristensen (Thu 17 Aug 1995 10:23) to All:

PK> How do I log information with time and date _and_ %S% _and_
PK> some additional information on _one_ line.

PK> I use MSDOS 6.22 and do not intend to use 4DOS and the likes
With my M.EXE:

:: the additional information is from an environment variable
 m [day3$] [date] [time] %s% %more%>>log.log

:: the additional information is entered from the console
 m [day3$] [date] [time] %s% [?Enter Addtional Info for Log]

:: the additonall information is the 1st line of a file
 m [day3$] [date] [time] %s% [@info.txt`1]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 24 '95, 00:24                                                Loc
From : Gary Mays                                              1:261/1191
To   : Jeff Lutkus
Subj : file size


@MSGID: 1:261/1191.0 3bfeb41
@REPLY: 1:141/1114.0 30380388
Quoting Jeff Lutkus (Sun 20 Aug 1995 23:53) to All:

JL> Does anyone know of any command parameter that can do
JL> something depending on a file size?
JL> I want to do something like: if %size !!!!!!!!.!!!=0 then
JL> goto end does anyone know of any way to do something like

With my M.EXE:

:: test for zero
m/set x=[getfsize`file.txt]
if %x%==0 goto zerofile
if %x%==-1 goto nofile
:: test for > 100,000 bytes
m/set x=[%x%`gt`100000]
:: or
m/set x=[[getfsize`file.txt]`gt`100000]
if %x%==T goto gt


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 31 '95, 07:53                                                Loc
From : Gary Mays                                              1:261/1191
To   : Lori Duquette
Subj : Trim var & create file?


@MSGID: 1:261/1191.0 459eea1
Quoting Lori Duquette (Thu 10 Aug 1995 20:50) to All:
.........
LD> The network card address (i.e. 0000C0AFDEC0) is already fed
LD> into a DOS  environment variable. Using
LD> invisible-to-the-user batch file ONLY, I need to create a
LD> decent filename.
LD> I guess I  want to trim the first 4 characters (they're
LD> ALWAYS zeros)  and then assign the remaining 8 characters as
LD> the filename (the  extension doesn't matter to me).
........
Using my M.EXE:

m/set fn=[ss`[env`netaddr]`5`8]


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 31 '95, 07:56                                                Loc
From : Gary Mays                                              1:261/1191
To   : Michel Castonguay
Subj : if < bytesfree goto end


@MSGID: 1:261/1191.0 459eea2
@REPLY: 1:167/625.0 8879D15D
Quoting Michel Castonguay (Mon 28 Aug 1995 14:50) to All:

MC> Can someone tell me how to abort a batchfile to proceed
MC> if LESS than 5000000 bytes are available on the current
MC> harddrive ?
Using my M.EXE:

m/set d=[[diskfree`]`ge`5000000]
:: careful about testing for le, no disk returns -1 as free space
if %d%==F goto not


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Aug 31 '95, 08:01                                                Loc
From : Gary Mays                                              1:261/1191
To   : Rick Gordon
Subj : 123...


@MSGID: 1:261/1191.0 459eea3
@REPLY: 1:130/612.0 39d2e30
Quoting Rick Gordon (Tue 22 Aug 1995 07:49) to All:

RG> batch file that will allow someone to run a program 2-3
RG> times then say "no more today... come back tomorrow"
With my M.EXE:

:: first, check if counter file exists for today:
  m/set a=[getfage`counter.x]
  if not %a%==0 goto first
  m/set c=[@counter.x]
  if not %c%==3 goto increment
  m/nul [msgdelay`No more today... come back tomorrow`3000]
::  or
:: m/nul [msgpause`No more today... come back tomorrow]
  goto nomore
::increment counter and save
:increment
  m/nul [c++]
  echo %c% >counter.x
  goto endcount
:first
  echo 1 >counter.x
:endcount
:: process your program here....
:nomore

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 02 '95, 01:59                                                Loc
From : Gary Mays                                              1:261/1191
To   : Bob Morton
Subj : REPEATING LIST


@MSGID: 1:261/1191.0 47edff3
@REPLY: 1:374/119@fidonet.org c503a36f
Quoting Bob Morton (Tue 22 Aug 1995 09:42) to All:

BM> I have a process that runs a variable number of times each
BM> day (0 to about 30...depending on other events that happen
.........
BM> For example, the list might look like this:
BM> 360
BM> 432
BM> 273
BM> 366   etc up to 30 different numbers.

BM> The first run of each day should use 360; 2nd run use 432;
BM> etc. To use these in my process, I can pick them up from an
...........
Using my M.EXE:

:: runs a program up to 30 times per day using the nth
:: line of RUNLIST as its parameter
:: RUNCOUNT is the daily counter of times event is run
:: RUNLIST is the list of parameters for each nth run
:: first, check if the run counter file exists for today:
  m/set a=[getfage`runcount]
  if not %a%==0 goto first
  m/set c=[@runcount]
  if not %c%==30 goto increment
  echo No more runs today
  goto norun
::increment counter and save
:increment
  m/nul [c++]
  goto runit
:first
  set c=1
:runit
:: process your program here....
  m/set p=[@runlist`%c%]
  echo Sequence %c%, using parameter %p%
  :: errorlevel 2 when unable to get line %c% from RUNLIST
:: after program is run, save the counter to the RUNCOUNT file
  echo %c% >runcount
  :: for os/2 VDM:
  :: when %c% is a single character, os/2 needs the space between
  :: the % and the redirection symbol
:norun
set c=
set p=


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 01 '95, 00:29                                                Loc
From : Gary Mays                                              1:261/1191
To   : Gary Snyder
Subj : will this work?


@MSGID: 1:261/1191.0 4682b54
@REPLY: 1:301/36.0 3043ce6e
Quoting Gary Snyder (Tue 29 Aug 1995 20:35) to All:

GS> I am trying to write a batch file that will "pause" for a
GS> set amount of time (like 5 seconds).
With my M.EXE:

m/nul [delay`5000]

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 02 '95, 21:22                                                Loc
From : Gary Mays                                              1:261/1191
To   : Scott Phung
Subj : Bat HELP!


@MSGID: 1:261/1191.0 4904660
@REPLY: 1:153/7093 3045ee6f
Quoting Scott Phung (Thu 31 Aug 1995 09:40) to James Lee:

SP> i want it to be something like this:

SP> 1.  file1.txt
SP> 2.  file2.txt
SP> 3.  file3.txt
SP> 4.  file4.txt
SP> 5.  file5.txt

SP> Please choose file to read.

XLIST.BAT
@echo off
:: make any processor have an easy to use pick list, just change :: the name of
the batch file and substitute the name of your processor :: in the appropriate
place....
:: Uses M.EXE by Gary Mays
:loop
  m/set f=[ufn`%1]
  if %f%'==T' goto unique
:ambiguous
:: --- execute via an environment variable set with M/SET
  M/SET n=[getfilen`%1]
  if errorlevel 1 goto shift
:: your processor name followed by %n% next:
  listr.com %n%
  goto ambiguous
:unique
:: your processor name followed by %1 next:
  listr.com %1
:shift
  shift
  if not %1'==' goto loop
:fin
set n=

Just type XLIST *.TXT, or modify XLIST.BAT to use pre-coded
parameters.

Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 09 '95, 02:29                                                Loc
From : Gary Mays                                              1:261/1191
To   : David Yon
Subj : batch


@MSGID: 1:261/1191.0 5134261
@REPLY: 1:133/9014 3043D057
Quoting David Yon (Mon 04 Sep 1995 20:55) to David Yon:

DY> can some one write a batch file that will add up a column of
DY> numbers? 

With my M.EXE:

m [9`add`10]   is the simplist form and produces the string 19.

Assume that an ASCII text file has two columns, a label without
imbedded spaces followed by a number. The following batch file
will produce the sum and count of the numbers.

SUM.LOG
-------
SUN 100
TUE 132
WED 95

SUM.BAT
-------
@echo off
m/set s=[[getfsize`sum.log]`gt`0]
:: getfsize returns -1 when file does not exist and 0 when file is
:: empty
if %s%==F goto not
set s=0
set c=0
m/set [nul`[c++]][parse` `[]`nul`v]s=[[env`s]`add`[env`v]]<sum.log
:: macros enclosed in brackets return a string that is possibly nul
:: [] is replaced by each standard input line
:: [c++] increments the environment variable c
:: [nul`info] turns info into a nul string
if not errorlevel 1 goto ok
m/nul [msgdelay`SUM.LOG has corrupted data`3333]
:goto fin
:ok
echo SUM.LOG has %c% items, totaling %s%.
goto fin
:not
m/nul [msgdelay`SUM.LOG is empty or does not exist`3333]
:fin
set c=
set s=


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 10 '95, 23:44                                                Loc
From : Gary Mays                                              1:261/1191
To   : Ray Igleheart
Subj : need help to finish


@MSGID: 1:261/1191.0 53ac461
@REPLY:  001681cd
Quoting Ray Igleheart (Mon 04 Sep 1995 19:11) to All:

RI> the purpose of users to complete and mail back. This form
RI> asks them basic questions, such as name, address, date of
RI> birth, etc.

RI> What I would prefer to do is ask them these questions, have
RI> them type in their responses and then consolidate the
RI> information and send it to the printer in a format similar
RI> to the pre-made form I stated above.  What command will
With my M.EXE:

SURVEY.TXT
----------
Name
First address line
Second address line (not city or state)
City, State  Zip

SURVEY.DAT
----------
[cap`[?Name]]
[cap`[?First address line]]
[cap`[?Second address line (not city or state)]]
[cap`[?City]], [ucase`[?State (2 letter abbrevation)]]  [?Zip]]

SURVEY.BAT
----------
@echo off
:again
  cls
  echo.
  echo Please answer these questions below:
  echo.
  type survey.txt
  echo.
  if exist %temp%\temp.txt erase %temp%\temp.txt
  m [!]<survey.dat >>%temp%\temp.txt
  if errorlevel 5 goto fin
  cls
  echo Here is your response:
  echo.
  type %temp%\temp.txt
  m/set m=[menu`Is the above data correct`Yes - Accept it`No - Re-enter it]
  if not %m%`==Y` goto again
  ::
  cls
  type %temp%\temp.txt
  :fin


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 11 '95, 00:46                                                Loc
From : Gary Mays                                              1:261/1191
To   : Wolfgang Eichel
Subj : Renaming files...


@MSGID: 1:261/1191.0 53ac462
@REPLY: 2:2437/840.12 bbf6ac48
Quoting Wolfgang Eichel (Thu 31 Aug 1995 22:48) to * All *:

WE> I have to copy a system file dayly for backup, but existing
WE> backups should not be overritten. I would like to get the
WE> following:

WE>                     filename.000   (1st day backup)
WE>                     filename.001   (2nd day backup)
WE>                         ...             ...
WE>                     filename.010        ...

WE> In other words, the file extension should be increased by
WE> one, if the file exists. Can this be done by a batch ?

Using my M.EXE:

The simplist way would be to use the 3 digit julian date:

  @echo off
  m/set f=FILENAME.[JULIAN]
  copy system.fil %f%

Next, a file named BACKUP.NUM with a single line with the number
of the current backup:

  @echo off
  :: uses backup numbers of 1-999. 1000 becomes 000, 1001=001,....
  if exist backup.num goto cont
  echo 0 >backup.num
  :cont
  :: fetch the current backup number
  m/set n=[@backup.num`1]
  :: inc n, then force n to 3 digit with leading zero fill
  m/set [nul`[++n]]n=[ltpad`[env`n]`3`0]
  :: save your data
  echo copy system.fil filename.%n%
  :: save the current backup number
  echo %n% >backup.num


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)

Area : BatPower Saved Messages

Date : Sep 19 '95, 02:07                                                Loc
From : Gary Mays                                              1:261/1191
To   : John Mudge
Subj : Testing file sizes


@MSGID: 1:261/1191.0 5d56cf7
@REPLY: 1:352/111 305a1405
Quoting John Mudge (Fri 15 Sep 1995 23:55) to All:
....
JM> The specific operation involves computing the total number
JM> of bytes of incoming mail and checking to see that twice as
JM> much free space exists on the drive I wish to toss them to. 
JM> If so, I would poceed with tossing.  If not, I would move
JM> them to a holding directory for later tossing.
I have SHOWFILE.EXE, a program that I developed recently, that can
display, move, or copy, any of mail, tic and tic'ed files, or
regular files. I just added another option to set an environment
variable with the byte size of the displayed files. Then, M.EXE,
another program that I have been trying to document can do math
with environment variables....

 :: check for incoming mail files and set b to bytes
   showfile /n/m/setb:b f:\inbound
   if not %b%==0 goto check
   m/nul [msg`No mail to toss]
   goto fin
 :check
 :: set x to T if ((2 x bytes)+20000) is less
 :: than the free space on drive G
   m/set x=[[[%b%`mul`2]`add`20000]`lt`[diskfree`g]]
 :: if T then toss
   if %x%==F goto nospace
   call toss f:\inbound
   goto fin
 :nospace
 :: move to holding directory
   showfile /n/m/moveto:f:\mailhold
   echo. >toss.now
 :fin


Gary

--- timEd/2 1.01
 * Origin: Gary's Desk * Baltimore MD * USA (1:261/1191)
