Sign in to follow this  
Followers 0
strate

Print on a network printer

15 posts in this topic

#1 ·  Posted (edited)

Is anybody aware of a method that can be used to print a .txt document on a network printer without opening the document, or right clicking it?

My desk is at one side of the building and where I want to print is at the other. I currently send a email with an attachment, but if I can print it at their printer, it would be great 'cause thats the first thing they do when they recieve my email.

EDIT: I would like it if the user never knew it was printed. Thats why I said without opening it or right clicking.

Edited by strate

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I'm not certain what this has to do with AutoIt...

If it's a true networked printer, you could print to it directly from your own computer....

If it has an IP Address, and your computer is running Windows 2000 or XP, you could setup printing.... Windows 98 would require extra steps to setup IP printing.

The other way of networking a printer is sharing it.... in which case you would need to setup printing to "\\computerName\printerName" which is equally easy under Windows 9x and 2000/XP

Edited by CyberSlug

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Check

RUNDLL32 PRINTUI.DLL,PrintUIEntry /?

for a list of command for making the printer you need the default one (and reset the old one after) Edit: this command may work only in Win2k/XP

and try:

$sVerb = 'Print'
$sCmd = 'c:\full path\here.doc'
$sFolder = 'c:\full path'

DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", $sVerb,"string", $sCmd, "string", '', "string", $sFolder, "long", @SW_SHOWNORMAL)
Edited by ezzetabi

Share this post


Link to post
Share on other sites

I'm not certain what this has to do with AutoIt...

If it's a true networked printer, you could print to it directly from your own computer....

If it has an IP Address, and your computer is running Windows 2000 or XP, you could setup printing....  Windows 98 would require extra steps to setup IP printing.

The other way of networking a printer is sharing it.... in which case you would need to setup printing to "\\computerName\printerName" which is equally easy under Windows 9x and 2000/XP

<{POST_SNAPBACK}>

This is for use in a large (well I think its large (16 pages size 8 font)) secondary program to be used with MFG/PRO. The basics of the program is that it is used to assist in recording production. When an error is returned it creates a log. I want the program to print the log without the user aware that it happened.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

Check

RUNDLL32 PRINTUI.DLL,PrintUIEntry /?

How do I go about this? Everything in that line doesn't look fimiliar

$sVerb = 'Print'
$sCmd = 'c:\full path\here.doc'
$sFolder = 'c:\full path'

DllCall("shell32.dll", "long", "ShellExecute", "hwnd", 0, "string", $sVerb,"string", $sCmd, "string", '', "string", $sFolder, "long", @SW_SHOWNORMAL)

<{POST_SNAPBACK}>

My help file doesnt recognize DllCall() as a function. Is that an oversight in the creation of the file or is it I'm using a different version?

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

You are most likely using a different version. Alot of the people in here have been using the beta version that has GUI functions among a bunch of other things.

Try in more detail to explain your situation. Is the printer a network printer with its own IP, or is it a printer at a work station that you are wanting everyones computer to print that log to? We need to know how it is that you expect this printer to be accessed before we can go about a way of telling you how to print there.

Thanks,

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

You are most likely using a different version. Alot of the people in here have been using the beta version that has GUI functions among a bunch of other things.

Try in more detail to explain your situation. Is the printer a network printer with its own IP, or is it a printer at a work station that you are wanting everyones computer to print that log to? We need to know how it is that you expect this printer to be accessed before we can go about a way of telling you how to print there.

Thanks,

JS

<{POST_SNAPBACK}>

I tried to use the beta version lastnight but couldn't figure out how to download and use it. Help with that would be appreciated.

I wouldn't want to use it here at work though (unstable). The printer has its own IP on the network. Everyone can print to it if they want, after they map to it of course.


INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

SO; user A is running some software but gets an error then autoit takes over and prints the error log to the default printer (in a different room) but with out user A knowing that the report was ever printed. (SPYWARE?)

in windows 98 you could capture port LPT3 or LPT4

then your command will only be:

COPY "filename.log" LPT3:

Share this post


Link to post
Share on other sites

The DOS command to accomplish what you want is:

Print /D:\\FileServerName\PrinterName LogFile.txt

So just create your RunWait script to run the Dos "Print" command as described above.

I am assuming that the network printer is also a printer on your Windows server (print queue).

The same command won't work using an IP address.

Hope this help.

RocTx

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

How do I go about this? Everything in that line doesn't look fimiliar

:) :) What about coping the line in the Run dialog and press enter?

Or... copy the line in a console window and press enter?

My help file doesnt recognize DllCall() as a function.

<{POST_SNAPBACK}>

You are not using the last (unstable) version of Autoit, most probably.

Still, probably the RocTx solution is the best, ;) but only for .txt files AFAIK.

Edited by ezzetabi

Share this post


Link to post
Share on other sites

The DOS command to accomplish what you want is:

Print /D:\\FileServerName\PrinterName LogFile.txt

So just create your RunWait script to run the Dos "Print" command as described above.

I am assuming that the network printer is also a printer on your Windows server (print queue).

The same command won't work using an IP address.

Hope this help.

RocTx

<{POST_SNAPBACK}>

I receive an error stating unable to initialize device.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

SO; user A  is running some software but gets an error then autoit takes over and prints the error log to the default printer (in a different room) but with out  user A knowing that the report was ever printed. (SPYWARE?)

in windows 98 you could capture port  LPT3 or LPT4

then your command will only be:

COPY "filename.log" LPT3:

<{POST_SNAPBACK}>

No, its not that i'm intending something like spyware, but I'm trying to create less problems for User A. At the very end of the shift when the user is on his/her way home they will exit this program and if a log has been created it will prompt that the log is being printed. Communication is key and if the user forgot to mention it to the correct people it will cause over production of product on the next two shifts. I'm trying to eliminate this communication. When the scheduler arrives at their desk the next morning they will see the printout. Make sense?

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...

Share this post


Link to post
Share on other sites

It makes sense what you are wanting to do... what I dont understand is how you are wanting to do it. If the printer is installed on UserA's computer then it should be easy. If the printer isnt then you will have to figure out how to get it installed. You should be in a position to install it for them.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

OK so the problem is:

user runs some program that runs for hours and when it finishes not one is there to see if it failed. An email is sent with a log but you want to print the log without an operator to pick a printer or clicking yes to choose a printer...

if your printer is defined in windows (THIS HAS TO BE DONE ONLY ONCE)

->control panel -> printers->"yourprinter"

"yourprinter"->properties->details

"Capture Printer Port" : here just choose lpt3 or lpt4 etc...

APPLY

NOW YOU CAN USE DOS TO COPY THE FILE TO THE PORT

copy LogFile.txt lpt3:

since you are doing a copy in dos there is no dialog and no trace of course LPt3: is now defined as a port for that printer.

Edited by normeus

Share this post


Link to post
Share on other sites

I receive an error stating unable to initialize device.

That quote tells me that either you are not referring to the printer correctly or it does

not exist on the network.

Describe your Network/Server setup.

1) Is the printer you are wanting to use defined on the server?

2) Is the printer installed on the local machine? (Listed in Printer/Faxes) Panel?

3) Where exactly is this printer and how is it connected? (Network Printer?) Shared

printer from a workstation?

I tried the command you say did not work for you before I posted it and it worked fine

for me. So we need to know more about your environment/setup/configuration.

RocTx

Share this post


Link to post
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
Sign in to follow this  
Followers 0