[Date Prev][Date Next][Subject Prev][Subject Next][ Date Index][ Subject Index]

Re: vDos users: be aware: can't print again if prior print has locked the port



Reply to note from Harry Binswanger  Tue, 20 Sep 2016
23:09:53 -0400

Harry,

> So some of this syntax wouldn't work with Command.com? Or, with
> 4DOS?

Are you kidding? No, of course not. The Windows batch language has
developed far beyond what it was in DOS. Granted, the syntax is
perverse, but still... 4DOS's batch language, on the other hand, has a
more sensible syntax -- command HELP at the 4DOS prompt, goto BATCH
FILES, then explore -- but its many unique and useful features only
work in 4DOS.

Speaking of batch files, since vDosPlus has solved the problem of
locked #LPT1.pdf files, there's no longer a need for my batch file
procedure to generate unique filenames. But since the procedure is
useful in other contexts, I've turned it into a demo. The listserv
won't allow me to me attach it to this message, so I've posted it here:

http://users.datarealm.com/ammaze/xfer/UNIQUE.BAT.txt

It's also ENCoded below (DEC to decode). Kind of fun to run.

XPLeNCODE v2.0 (ENCODE.EXE)
b-gin [UNTITLED]
:: UNIQUE.BAT -- CLD rev.9/20/16[cr|lf]:: Demo of batch-file t
echnique for generating unique temp file names[cr|lf]:: Usage:
[cr|lf]:: UNIQUE.BAT {091}"basename"{093} {091}number_of_temp_
files_to_generate{093}[cr|lf]:: E.g. UNIQUE.BAT "test" 10[cr|lf]
:: -----------------------------------------------------------
-------[cr|lf]@echo off[cr|lf]cls[cr|lf]echo This demo generat
es a stream of unique temporary filenames.[cr|lf]echo Each fil
ename includes a basename and the current date ^& time,[cr|lf]
echo  followed by a pseudo-random number.[cr|lf]echo.[cr|lf]e
cho The default basename is "{091}basename{093}".[cr|lf]echo Y
ou can specify a different basename (in quotes) on the command
 line:[cr|lf]echo  UNIQUE.BAT "basename"[cr|lf]echo.[cr|lf]ec
ho The demo stops after generating 100 unique non-existent fil
enames.[cr|lf]echo You can set a different number on the comma
nd line; e.g.:[cr|lf]echo  UNIQUE.BAT 10[cr|lf]echo  UNIQUE.
BAT 500[cr|lf]echo.[cr|lf]pause[cr|lf]echo.[cr|lf]set _temp=X[cr|lf]
set basename={091}basename{093}[cr|lf]if not "%1"=="" ([cr|lf]
 if not "%{126}1"=="%1" ([cr|lf]  set basename=%{126}1[cr|lf]
  shift /1[cr|lf] )[cr|lf])[cr|lf]if %basename%=={091}basen
ame{093} if "%2"=="" shift /1[cr|lf]set /a _count=0[cr|lf]set{032}
/a _upper=100[cr|lf]if not "%1"=="" set /a _upper=%1[cr|lf]:A[cr|lf]
for /f "tokens=2-8 delims=,-./: " %%a in ("%DATE%%TIME%%RANDOM
%") do set tempfn=%basename%-%%a%%b%%c%%d%%e%%f%%g.pdf[cr|lf]s
et /a "_count{043}=1"[cr|lf]if not exist %tempfn% echo %_count
%: %tempfn%[cr|lf]if %tempfn%==%_temp% ([cr|lf] set /a "_coun
t-=1"[cr|lf] echo.[cr|lf] echo Duplicate: %tempfn%[cr|lf] p
ause[cr|lf] goto :A[cr|lf])[cr|lf]if %_count% LSS %_upper% ([cr|lf]
 set _temp=%tempfn%[cr|lf] goto :A[cr|lf]) else ([cr|lf] fo
r %%a in (_count _temp basename tempfn) do set %%a=[cr|lf] ec
ho.[cr|lf] echo Done.[cr|lf] echo Press a key to quit...[cr|lf]
 pause >nul[cr|lf] goto :eof[cr|lf])[cr|lf]
-nd
XPLeNCODE

--
Carl Distefano
cld@xxxxxxxx