Qbasicnews.com
February 23, 2020, 08:54:42 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: [1] 2 3
  Print  
Author Topic: print to USB  (Read 10171 times)
philip
New Member

Posts: 6


« on: June 03, 2005, 10:29:02 AM »

How I do send print statements to a USB port?

Is there a way to capture LPT1 as there is with network printers?

Thanks,
Logged

hilip Clemmons
Cullman, Alabama
Moneo
Na_th_an
*****
Posts: 1971


« Reply #1 on: June 03, 2005, 03:03:46 PM »

Philip,

You might look at doing a
MODE LPT2:=COMm:
from MSDOS first, and then open LPT2 in your program and print to it.
From the MSDOS commandline do: MODE /? for options.

Do you have a printer on your USB port? If not, then just output your "printer" output to a text file, and later copy the file using Windows to your USB device.

Regarding your second question, I don't know what you mean by "capture" LPT1.
*****
Logged
philip
New Member

Posts: 6


« Reply #2 on: June 03, 2005, 03:53:17 PM »

One, I have a new Dell printer connected via a USB port to my new Dell laptop.  When I try to send a DOS print it automatically goes to LPT1, and there is nothing there, so the computer freezes. In my previous company we had had a large Novel network and a number of network printers and print servers. We used a lot of Capture and End Capture statements.

Two, what I was really looking for is a command to redirect the print from LPT1 to the USB port.

Thanks,

Philip
Logged

hilip Clemmons
Cullman, Alabama
Moneo
Na_th_an
*****
Posts: 1971


« Reply #3 on: June 03, 2005, 04:38:21 PM »

Philip,

I scouted around, and several people say that you can't print to a USB directly from DOS, because the USB is a Windows-only device.

I did find this little program, which is basically an automation of my previous solution regarding printing to an intermediate file. I haven't tested it. If it works, it's more elegant than my solution.

----------------------------------------------------------------------------------
Well, this code example should work perfectly fine for all printers, USB included. Windows platform only, of course.

DATAFILE$ = "TEST.TXT"
OPEN DATAFILE$ FOR OUTPUT AS #1
PRINT #1, "Data "
CLOSE #1

SHELL "start /m wordpad /p TEST.TXT"
---------------
The SHELL command is the key to your situation. You can save the output data into a text file, then simply use WordPad with the /p convention to print the file. This should work with any printers installed to Windows......
-----------------------------------------------------------------------------------
*****
Logged
philip
New Member

Posts: 6


« Reply #4 on: June 03, 2005, 05:59:56 PM »

Thanks for the information.

I can easily write to an ascii file, and name the ascii file with an .XLS extension, then open in Excel.

I was looking for something I could do inside the QBX environment, while working on the code, or formatting the print using statements.

Philip
Logged

hilip Clemmons
Cullman, Alabama
barok
Na_th_an
*****
Posts: 1727


How about a tasty lead sandwich?


« Reply #5 on: June 03, 2005, 07:58:22 PM »

if legacy usb support is enabled through the bios, shouldn't there then be support for usb ports through dos?  I'm not quite sure about what i'm saying. Tongue
Logged

Jumping Jahoolipers!
Kylemc
Guru
**
Posts: 291



WWW
« Reply #6 on: June 04, 2005, 05:48:59 AM »

http://www.google.co.uk/search?hl=en&q=USB+DOS&btnG=Google+Search&meta=

Read away..
Logged
barok
Na_th_an
*****
Posts: 1727


How about a tasty lead sandwich?


« Reply #7 on: June 04, 2005, 02:23:24 PM »

http://www.informationweek.com/story/IWK20021003S0007

this site contains a bit of information on getting some usb support in dos... through the usage of either USB Legacy support and dos drivers.
Logged

Jumping Jahoolipers!
Sebastian
Member
*
Posts: 73



WWW
« Reply #8 on: June 23, 2005, 10:32:18 AM »

Hi,

you could try this:
Code:
NET USE LPT2: \\COMPUTER\MYPRINTER


Then you can print on that printer like this
Code:
OPEN "lpt2:" FOR OUTPUT AS #1
PRINT #1, "Something"
CLOSE #1


Greetings!
Sebastian
Logged

philip
New Member

Posts: 6


« Reply #9 on: June 23, 2005, 12:13:42 PM »

Thanks for the reply.

When I type  "net use lpt2: \\computer\myprinter"

I get an error message. I am using QBX7. I do not have a "net" or "net use" or "use" command.

Philip
Logged

hilip Clemmons
Cullman, Alabama
Sebastian
Member
*
Posts: 73



WWW
« Reply #10 on: June 23, 2005, 12:58:05 PM »

Well, NET is just available if you run your program under Windows.  :-?
Logged

whitetiger0990
__/--\__
*****
Posts: 2964



WWW
« Reply #11 on: June 23, 2005, 01:08:04 PM »

SHELL to it

Code:
SHELL "net use lpt2: \\computer\myprinter"
Logged


[size=10]Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.[/size]
Sebastian
Member
*
Posts: 73



WWW
« Reply #12 on: June 23, 2005, 02:29:15 PM »

Oh, of course, I forgot to say that...  Smiley
Logged

Ralph
Ancient Guru
****
Posts: 544


« Reply #13 on: July 25, 2005, 06:45:31 PM »

Phillip, did you get your problem solved?  It would be nice to know exactly how.
Logged

Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
philip
New Member

Posts: 6


« Reply #14 on: July 25, 2005, 07:36:48 PM »

Yes and no,

I have been writing to an ASCII file, then open in Excel, then print. It is cumbersome, but it works. A friend told me last week there is a conversion cord so you can plug the USB into LPT1. I haven't found one of those yet.

Philip
Logged

hilip Clemmons
Cullman, Alabama
Pages: [1] 2 3
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!