echo off

rem SETPRN.BAT

rem If you get an "Out of environment space" message, increase your
rem environment space by using shell configuration in config.sys:
rem MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p

rem Check that ask.exe is available at path or the current directory
set _found=no
if exist ask.exe set _found=yes
for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
if "%_found%"=="no" goto _err2

:_begin
cls
echo [0;41;33;1mÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ Set an Epson compatible printer (Diconix 150) from a batch menu   ³
echo ³ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Vaasa, Finland, 13-Mar-91 ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
echo [40;33;1m

rem Make a menu, liven it up with colors
echo [42;37;1mÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
echo ³ 0) Exit the menu              ³
echo ³ 1) Reset printer              ³
echo ³ 2) Wide condensed             ³
echo ³ 3) Wide condensed, Emphasized ³
echo ³ 4) Condensed                  ³
echo ³ a) Spacing 75                 ³
echo ³ b) Spacing 80                 ³
echo ³ c) Spacing 90                 ³
echo ³ d) Spacing 100                ³
echo ³ e) Spacing 123                ³
echo ³ f) Spacing 137.5              ³
echo ³ g) Spacing 150                ³
echo ³ h) Spacing 200                ³
echo ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
     
rem Make the choice and set the code for the printer
echo [40;33;1m
ask Select: /l /d
set _code=
if errorlevel==48 if not errorlevel==49 set _code=_exit
if errorlevel==49 if not errorlevel==50 set _code=@
if errorlevel==50 if not errorlevel==51 set _code=!$
if errorlevel==51 if not errorlevel==52 set _code=!,
if errorlevel==52 if not errorlevel==53 set _code=!
if errorlevel==97 if not errorlevel==98 set _code=0
if errorlevel==98 if not errorlevel==99 set _code=3&
if errorlevel==99 if not errorlevel==100 set _code=3+
if errorlevel==100 if not errorlevel==101 set _code=2
if errorlevel==101 if not errorlevel==102 set _code=3;
if errorlevel==102 if not errorlevel==103 set _code=3B
if errorlevel==103 if not errorlevel==104 set _code=3H
if errorlevel==104 if not errorlevel==105 set _code=3`

if "%_code%"=="_exit" goto _out
if "%_code%"=="" goto _err1

rem Send the code to the printer
echo %_code% > prn

:_again
ask [0;45;36;1mSelect from the menu again (y/n)?[40;33;1m /u /d
if errorlevel==89 if not errorlevel==90 goto _begin
if errorlevel==78 if not errorlevel==79 goto _out
echo 
goto _again

:_err1
echo [40;31;3;5mNo such choice available
goto :_again

:_err2
echo [40;31;3m
echo You must have ask.exe at your path (or the current directory)
goto _out

:_out
set _code=
set _found=
echo [0;40;33;1m
echo on
