Category : Batch File Utilities - mostly for DOS
Archive   : BATMODEM.ZIP
Filename : MODEM.DOC

 
Output of file : MODEM.DOC contained in archive : BATMODEM.ZIP
________________________________________________________

MODEM DOCumentation
________________________________________________________

MODEM gets modem responses in batch files and returns an
errorlevel that can be tested. Using it, you can
determine if the line was busy and redial. You can also
adjust the port speed to match the speed the modems
connected at. Here is an example batch file using
MODEM that will dial out and send a file to another
system:

echo off
mode COM1:2400,N,8,1
echo ATX4M1 > COM1
:DIAL
echo ATDT555-1212 > COM1
modem
if errorlevel 24 goto C2400
if errorlevel 12 goto C1200
if errorlevel 2 goto BUSY
goto end

:BUSY
echo Redialing
stackey {wait=255}
goto DIAL

:C2400
echo Connected at 2400 baud
goto SENDIT

:C1200
echo Connected at 1200 baud
mode COM1:1200,N,8,1

:SENDIT
TYPE FILENAME.DAT > COM1

:end
stackey {wait=54}
echo +++
stackey {wait=54}
echo ATHO > COM1


First, echo is turned off. Then the comm port is setup
for the modem parameters. An echo command is then used
to initialize the modem and followed with a dial
command. MODEM is then run to wait on the response. If
a normal 2400 baud connection is made, MODEM will exit
with an errorlevel of 24 and the batch file will branch
to C2400. Here a short message is displayed using echo
and then a branch is made to SENDIT. FILENAME.DAT is
then typed and redirected to the comm port. You could
use replaceable parameters to call the batch file with
different filenames instead of a hard coded one. After
the file is typed to the comm port, it falls through to
END where an echo command hangs up the modem. It uses
stackey to generate a 3 seconds wait, sends 3 pluses to
the modem, waits 3 seconds, and then sends a hangup
command. Had the modems connected at 1200 baud, MODEM
would have returned an errorlevel of 12 and the
errorlevel tests would have branched to C1200. Here
mode is used to adjust the port speed to 1200 baud. It
will then fall through and type the file to the comm
port. If a BUSY is detected, stackey is again used to
generate a 14 second pause before branching back to DIAL
and doing a redial.

Any other modem responses will return an errorlevel of
1. Since the batch file is not sure what is being
returned, it hangs up the phone and exits just to be
safe. I chose to use STACKEY for the waits but you can
use whatever you have to do the same thing. STACKEY
uses the number of clock ticks to do the wait so the
wait time is about 18.1 times the number of seconds to
wait. I am also including a program called HANGUP which
will hangup the modem by dropping DTR. I perfer this
method but did it wanted to show another way of doing it
as well.

MODEM will exit with an errorlevel of 0 if you press
ESCape while it is running. All modem responses are
displayed on the screen before MODEM exits.

MODEM will work with COM1 and COM2. The default is
COM1. Use a command line parameter of 2 for COM2.

MODEM uses the BIOS comms routines. Some slow systems
may not be able to use it. Use of these routines allows
the program to remain tiny and also allows the use of
non-compatible comm ports. HANGUP does require a
compatible comm port. If yours isn't compatible, try
the method of hanging up used in the example batch file
above.


Legal stuff

MODEM is donated to the Public Domain. Use it freely
and in good health. No contribution is requested by the
author and no responsibility is assumed by him either.
You run MODEM entirely AT YOUR OWN RISK. While it runs
fine on his 286 compatible, it is the only system it has
been tested on.



  3 Responses to “Category : Batch File Utilities - mostly for DOS
Archive   : BATMODEM.ZIP
Filename : MODEM.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/