Jump to content

How to send data directly to a usb printer port


Recommended Posts

Hi,

Im trying to write a small program which sends files (plt files) directly to a printer. So far was able to write the autoit code to send plt files to a network printer via tcpsend to port 9100 (socket printing). My intention is to have in addition the possibility to send the files directly via usb to the printer. Sadly I have no idea how to realize this. As Im new with autoit I was hoping that there exists something similar to tcpsend for a usb connection. To make things even more complicate, the printer usb port and printertype can change, meaning the usb port will not be always the same, also the printer will change depending which printer was connected to the laptop. Ive seen an application where the currently active (usb printer was inserted) usb port was displayed in a combobox . Can anybody provide me some hints how to archive this. After searching now for hours in this forum and googling around I start to think that its nearly impossible with autoit.

Cheers

jogi

Link to comment
Share on other sites

I've solved my problem by

1. collecting all usb printers via wmi (displayed in an combobox)

2. based on the choice made in the combobox, creating a printer network share for this printer

3. RunWait copy /b $file \\127.0.0.1\$printername

4. Remove the printer share

This is not what I really wanted, but it works as long as a windows queue (driver installation has to be done) for the printer has been created.

-so long

jogi

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...