Posts: 285
Threads: 70
Joined: Feb 2005
I cannot get an Epson Stylus S22 USB printer to printout using the usual LPRINT with QB. I expect other USB printers do not work now with QB
Any suggestions please. The printer works OK with other Basics etc.
Posts: 3
Threads: 1
Joined: Jul 2006
02-20-2013, 09:46 PM
(This post was last modified: 02-20-2013, 09:52 PM by burger2227.)
You can assign the LPRINT text output to the default USB printer.
Code:
CLS
COLOR 11: LOCATE 2, 20: PRINT "XP or NT USB Printer to assign for LPRINT"
COLOR 10: LOCATE 3, 4: PRINT "In Control Panel, set the USB printer to Share with Text Format (not RAW)."
Computer$ = ENVIRON$("COMPUTERNAME")
IF LEN(Computer$) = 0 THEN
     SHELL "NET VIEW"
     COLOR 14: INPUT "        Enter your NT Computer Name: ", Computer$
END IF
IF LEN(Computer$) THEN
  SHELL "NET VIEW " + Computer$: COLOR 10: PRINT "   Computer Name = "; Computer$
ELSE : COLOR 12: PRINT " Â Â Â Â Â Program cannot Continue!": SLEEP 4: SYSTEM
END IF
COLOR 14: INPUT " Â Â Â Â Enter the USB Printer's Share Name from above: ", Printer$
PRINT
IF LEN(Printer$) THEN
  SHELL "NET USE LPT1 \\" + Computer$ + "\" + Printer$
ELSE : COLOR 12: PRINT " Â Â Â Â No Entry, Program Aborted! ": SLEEP 4: SYSTEM
END IF
PRINT
COLOR 10: PRINT " Â Â Â Â Â Â Â Testing your Printer!"
LPRINT "Test of USB Printer use with LPRINT in NT!" + CHR$(10) 'linefeed
LPRINT CHR$(12) 'formfeed
COLOR 14: PRINT " Â Â Â Â Â Did the Printer work correctly? (Y/N) ";
DO: work$ = UCASE$(INKEY$): LOOP UNTIL work$ = "Y" OR work$ = "N"
COLOR 11: PRINT work$
PRINT
IF work$ = "Y" THEN
  OPEN "NOLPRINT.BAT" FOR OUTPUT AS #4
   PRINT #4, "ECHO Removing LPT to USB printer Network!"
   PRINT #4, "NET USE LPT1 \\" + Computer$ + "\" + Printer$ + " /delete"
   PRINT #4, "PAUSE"
  CLOSE #4
  COLOR 10: PRINT : PRINT "NOLPRINT.BAT created! Use BAT file to cancel sharing."
ELSE :
  SHELL "NET USE LPT1 \\" + Computer$ + "\" + Printer$ + " /delete"
  COLOR 12: PRINT " Sorry! Did not setup printer! Check your printer settings. "
END IF
SYSTEM
See Chapter 11, Part 7 of my Qbasic tutorial to set up the Print Processor:
http://bit.ly/MXFkTM
You need to enable printer sharing on your network(a single PC has its own network) and run the program above. Set the Print Processor up for TEXT, not LEMF or RAW.