|
-
March 11th, 2003, 01:07 AM
#1
Prompt if Cant Write to LPT1
Hi,
I wanna include this lines in the autoexec.bat file:
@echo ff
copy test.txt lpt1
What this txt file does is to reconfigure the printer's setting. It will set the paper size to A4.
Now, I got a problem here. The file updates the printer at boot time. But sometimes, the users do not turn on the printer. And then the error will be shown saying
Write fault error writing device LPT1
Abort, Retry, Ignore, Fail?
How do I program in such a way that if the above error appears, another message also shows telling user to turn on the printer, if they have not done so. Something like this:
Please turn on printing device.
Write fault error writing device LPT1
Abort, Retry, Ignore, Fail?
Thanks!
Last edited by topdome; March 11th, 2003 at 01:20 AM.
EveryONe I daTe alw@ys turns out to be sUCh a cyborg.
-
March 11th, 2003, 07:42 PM
#2
Hi There,
Could you add the following lines above your copy command ?
@ECHO OFF
ECHO Please make sure the printer
ECHO is turned on before you continue
PAUSE
copy test.txt lpt1
Dave
*** Help others less fortunate.
JESUS IS LORD !
-
March 11th, 2003, 11:44 PM
#3
hi davidgsmith,
thanks for your suggestion. but i got one problem with that.
most of the time the printer will be on. so, by adding those additional lines, the batch will pause every time, irregardless whether the printer is turned on or not.
any other way?
thanks!
EveryONe I daTe alw@ys turns out to be sUCh a cyborg.
-
March 12th, 2003, 12:10 AM
#4
Wait a little longer and I'm sure one of the DOS gurus will supply the answer.
Vernon most probably.
-
March 12th, 2003, 07:36 PM
#5
Hey topdome,
I was thinking about this, this afternoon 
Unfortunately I'm at the limits of my batting skills 
There should be some time of function that could be run at this time in the autoexec.bat to see if the printer is turned on.
Don't know what if any, info about your printer or what type connection it has would be relevent to performing that function.
The gentleman mentioned above, Vern, has a website site with many batch file links. You could start looking yourself for something that might work.
http://www.comp-air.com/vfrazee/batch/index.htm
Let us know,
Dave
*** Help others less fortunate.
JESUS IS LORD !
-
March 12th, 2003, 08:06 PM
#6
Hi topdome, here's a group of batch utilities that I find almost indispensible, including one called PCHECK.COM that checks to see if a parrallel printer is present. Looks like what you're looking for.
Dex
EDIT: You want to download the file called horst32.zip.
And, authors homepage has more good tools and info.
Also, if you decide to use this, I would suggest this: Make the printer test as a separate batch file that you call at the end of the autoexec.bat. Call it something like PRNTTEST.BAT, or whatever you want. Then, add this line to the end of your autoexec.bat:
PRNTTEST.BAT
Then, use something like this for the actual batch file:
:: prnttest.bat
@echo off
pcheck.com
if not errorlevel goto Main
cls
echo.
echo Please turn printer on before continuing!
echo.
pause
:Main
copy test.txt lpt1
And obviously, either put PCHECK.COM in your C:\DOS or C:\WINDOWS\COMMAND directory, or include its full path in the batch file, ie.,
C:\DOS\HORST\PCHECK.COM
or where ever you put it.
Last edited by Dexahol; March 12th, 2003 at 08:41 PM.
-
March 13th, 2003, 06:37 AM
#7
Here and example of one way to do it using nothing more than DOS:
Code:
@echo off
echo [Alt-12]>~
:PRNtest
command/f/ccopy ~ prn|find "1 file(s) copied">nul
if errorlevel 0 if not errorlevel 1 goto PRNready
echo.
echo Please make sure the printer is ready and then press [Enter] ...
pause>nul
goto PRNtest
:PRNready
del ~
:End
Notes:- You'll need to replace that complete "[Alt-12]" string, (including the square-brackets), with the single form-feed character. Save the above as a text file then load it in EDIT. Delete the "[Alt-12]" string then, while holding down the [Alt] key, press the [1] then the [2] key on the numerical keypad, (not the keys at the top of the keyboard), then release the [Alt] key. The character you get should look like the one next to the "12" on this page: http://64.70.165.184/vfrazee/ascii.htm
- I'd probably add the above, (minus the "@echo off" line), to the C:\AUTOEXEC.BAT file.
- There is one small downside to using this approach. If the printer is not on when DOS processes these lines, as soon as you do turn it on, the printer will eject a piece of paper.

-
March 19th, 2003, 11:53 AM
#8
thanks alot vernon!
didnt noe tat DOS is capable of all these!!!
cool !
EveryONe I daTe alw@ys turns out to be sUCh a cyborg.
-
March 20th, 2003, 06:34 AM
#9
You're Welcome! Glad I was able to help.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|