Jump to content

I need a hero


Recommended Posts

I have been on hiatus from scripting for 2 years. I have recently been contracted by my former employer to help out with a couple of time sensitive projects. I am trying to write a script that needs a piece I have never dealt with before. Do to the time crunch; Im looking for some help.

I need to tell an AS400 to send a print job to a computer. The AS400 needs to think that it is sending to a printer. I need the PC to have a script running that listens for incoming print jobs and then executes other processes on the incoming file. I cant get my mind around the listening piece.

I am looking for a script that will listen for incoming print jobs and then do something with the incoming file. The something is in the rests of my script.

Link to comment
Share on other sites

  • Developers

Assuming you use the IP defined printer which uses the LPR protocol, you will need to listen to port 515 after which you need to capture the 2 files send to you. One file ontains the Job information and the orther contains the actual printer data.

I once wrote a VB which functions as an LPD and would forward the generated output to the EMail address connected to the target printername.

It was able to handle 10 concurrent print jobs.

This is not a trivial task to write a dedicated script. Attached is the RFC that describes the whole process of an LPD.

One other approach could be to have a dedicated PC and install the Microsoft Printing for Unix on it, which is the LPD. Then define a printer which will print to a file. everytime you print to it you will be prompted for the target file. so make a script to wait for that outputfile prompt, fill it in and wait for the print to finish. After that you can process the file.

Just thinking out loud here :)

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thank you for your response. One issue I have is that I cannot touch the AS400 other than to tell ot what IP the "printer" is at. So there's no installing, setup, or file location instruction options on the source machine.

Setting this up via standard network printer setup would require me to be able to tell the source machine the name of the printer attached to the destination PC. But again, I cannot tell the AS400 anything other than the printer IP. The destination PC will be a designated PC for this process. No printer will actually be attached.

Thinking out loud is how we get things done.

Link to comment
Share on other sites

  • Developers

Thank you for your response. One issue I have is that I cannot touch the AS400 other than to tell ot what IP the "printer" is at. So there's no installing, setup, or file location instruction options on the source machine.

Setting this up via standard network printer setup would require me to be able to tell the source machine the name of the printer attached to the destination PC. But again, I cannot tell the AS400 anything other than the printer IP. The destination PC will be a designated PC for this process. No printer will actually be attached.

Thinking out loud is how we get things done.

When the AS400 prints to an LPD it will use a remote printername so its a matter of figuring out what that is and create a printer with that name.

Did you try setting up theUnix printing on a PC and give that a try to see what happens?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • 2 weeks later...

Last year I had to process the PCL output from an AIX host; my only chance was to configure a PC as a virtual printer and assign a proper IP address to it. I used a little LPD daemon written a few years ago by Rocco LaPadula, a smart (and kind) guy from Canada. The daemon keep listening to port 515 and creates a couple of files for each print job received. I added a small AutoIt script to monitor the directory and process the data. It still runs pretty well. The solution has a couple of limits you have to work around. The directory where received jobs are enqued is the same from where you launch the exe; file names assigned to received jobs are serialized using an internal counter which is limited to 100, so you have to include some kind of housecleaning in your code.

Here you can find a link to the binary lpd.exe

http://www.digitalissues.co.uk/html/software/utils/pdl-capture.html

I really hope you can find my solution useful for addressing your problem.

Cesare

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...