By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,611 Members | 1,627 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,611 IT Pros & Developers. It's quick & easy.

Easiest way to print from XP/DOS.

P: n/a


This is the situation I'm in.

I've built a single file utility using py2exe. I
zip the dist directory and send it to the client.

For clients that use win95, win98 machines,
They unpack the zip file and run the exe.

The utility creates a text file that is sent to
the printer with the statement below.
os.system('type ' +FileName+ ' >prn'),
and the file prints.

But, from an xp machine if I try to print using
the same statement, I get a question on the dos
screen which reads something like this;
Which program authorized this operation?

Since I don't have an xp machine, the statement
above may not be exact, but you get the idea.

The question I have is, first is there any way to
work around the question asked by the xp machine
using python.

If not, I may have to register the package in xp,
if registering the utility the only way, which
package is the simplest to use.
Also, if the utility is registered in xp, will the
same statement send the file to the printer as it
does in win98.

jim-on-linux



Dec 29 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
jim-on-linux wrote:
>
This is the situation I'm in.

I've built a single file utility using py2exe. I
zip the dist directory and send it to the client.

For clients that use win95, win98 machines,
They unpack the zip file and run the exe.

The utility creates a text file that is sent to
the printer with the statement below.
os.system('type ' +FileName+ ' >prn'),
and the file prints.

But, from an xp machine if I try to print using
the same statement, I get a question on the dos
screen which reads something like this;
Which program authorized this operation?

Since I don't have an xp machine, the statement
above may not be exact, but you get the idea.

The question I have is, first is there any way to
work around the question asked by the xp machine
using python.

If not, I may have to register the package in xp,
if registering the utility the only way, which
package is the simplest to use.
Also, if the utility is registered in xp, will the
same statement send the file to the printer as it
does in win98.

jim-on-linux
I don't get any such message on my XP Pro Service Pack 2 system
here using your method.

-Larry
Dec 29 '06 #2

P: n/a

Did you run from a file or type in from keyboard?

When the client runs the utility program the
output file is built but nothing prints and no
messages appear. When I typed from keyboard on an
xp pro at c:\, I got the message.

Is it possible that virus detector or some
self.defense software is interacting?
On Friday 29 December 2006 17:58, Larry Bates
wrote:
jim-on-linux wrote:
This is the situation I'm in.

I've built a single file utility using
py2exe. I zip the dist directory and send it
to the client.

For clients that use win95, win98 machines,
They unpack the zip file and run the exe.

The utility creates a text file that is sent
to the printer with the statement below.
os.system('type ' +FileName+ ' >prn'), and
the file prints.

But, from an xp machine if I try to print
using the same statement, I get a question
on the dos screen which reads something like
this; Which program authorized this
operation?

Since I don't have an xp machine, the
statement above may not be exact, but you get
the idea.

The question I have is, first is there any
way to work around the question asked by the
xp machine using python.

If not, I may have to register the package in
xp, if registering the utility the only way,
which package is the simplest to use.
Also, if the utility is registered in xp,
will the same statement send the file to the
printer as it does in win98.

jim-on-linux

I don't get any such message on my XP Pro
Service Pack 2 system here using your method.

-Larry
Dec 30 '06 #3

P: n/a
jim-on-linux wrote:
When the client runs the utility program the
output file is built but nothing prints and no
messages appear.
If the file has a '.txt' extension, you could try os.system'ing
"start <filename>", which'll make the file pop open with notepad (or
whatever happens to be associated with TXT files), from which the user
would need to press Ctrl-P to make it print.
Is it possible that virus detector or some
self.defense software is interacting?
Quite. I run firewall software on my PC that alerts me when a program
is trying to launch another program. The message that it gives is not
entirely unlike the one you gave me.

To diagnose further, you could have the victim send you a screenshot to
see what's really going on. With Outlook, it's as easy as hitting the
Print Screen button (when the message is visible) and pasting the
clipboard into an email. Alternatively, they paste into MS Paint, save
the bitmap somewhere, and mail that to you.

Good luck,
-tom!

--
Dec 30 '06 #4

P: n/a
jim-on-linux <in*****@verizon.netwrote:
>
Did you run from a file or type in from keyboard?

When the client runs the utility program the
output file is built but nothing prints and no
messages appear. When I typed from keyboard on an
xp pro at c:\, I got the message.

Is it possible that virus detector or some
self.defense software is interacting?
It is quite possible that they simply do not have a printer hooked up to
their computer's parallel port. If all of your printers are from network
shares, then the special file "prn" will not go anywhere.

Typing to "prn" is a dreadful way to do printing on Windows.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 30 '06 #5

P: n/a
jim-on-linux wrote:
The utility creates a text file that is sent to
the printer with the statement below.
os.system('type ' +FileName+ ' >prn'),
and the file prints.

But, from an xp machine if I try to print using
the same statement, I get a question on the dos
screen which reads something like this;
Which program authorized this operation?

Since I don't have an xp machine, the statement
above may not be exact, but you get the idea.
You might want to look at this for some more
conventional approaches to printing under
windows:

http://timgolden.me.uk/python/win32_how_do_i/print.html

Specifically, I think you want the second option.

TJG

Dec 30 '06 #6

P: n/a


Thanks,
The client is in a one printer office. If the
output file is opened with note and then sent to
the printer everything is fine but it defeats the
purpose of the utility. Also tried lpt1 but
the same results.

I'm trying to find out if this was some change in
xp from previous versions, or is there something
abnormal going on. I'm trying to avoid setting
up an xp machine for one client.
jim-on-linux


On Saturday 30 December 2006 03:05, Tim Roberts
wrote:
jim-on-linux <in*****@verizon.netwrote:
Did you run from a file or type in from
keyboard?

When the client runs the utility program the
output file is built but nothing prints and no
messages appear. When I typed from keyboard on
an xp pro at c:\, I got the message.

Is it possible that virus detector or some
self.defense software is interacting?

It is quite possible that they simply do not
have a printer hooked up to their computer's
parallel port. If all of your printers are
from network shares, then the special file
"prn" will not go anywhere.

Typing to "prn" is a dreadful way to do
printing on Windows. --
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 30 '06 #7

P: n/a

Thanks,
However, using note to print is a problem. First,
because note adds a header( file name etc.) to
the printed output that is not acceptable. Next,
the number of files is 200 to 300 per day. The
idea of the utility is to eliminate the operator.

But, if you have a virus detector that stops the
operation then I think I may have to install the
program as opposed to unzipping and running the
exe file.


On Saturday 30 December 2006 01:33, Tom Plunker
wrote:
jim-on-linux wrote:
When the client runs the utility program the
output file is built but nothing prints and
no messages appear.

If the file has a '.txt' extension, you could
try os.system'ing "start <filename>", which'll
make the file pop open with notepad (or
whatever happens to be associated with TXT
files), from which the user would need to press
Ctrl-P to make it print.
Is it possible that virus detector or some
self.defense software is interacting?

Quite. I run firewall software on my PC that
alerts me when a program is trying to launch
another program. The message that it gives is
not entirely unlike the one you gave me.

To diagnose further, you could have the victim
send you a screenshot to see what's really
going on. With Outlook, it's as easy as
hitting the Print Screen button (when the
message is visible) and pasting the clipboard
into an email. Alternatively, they paste into
MS Paint, save the bitmap somewhere, and mail
that to you.

Good luck,
-tom!

--
Dec 30 '06 #8

P: n/a

jim-on-linux wrote:
Thanks,
The client is in a one printer office. If the
output file is opened with note and then sent to
the printer everything is fine but it defeats the
purpose of the utility. Also tried lpt1 but
the same results.
This may not help, but it worked once for me
although I don't remember the exact circumstances.

If the printer is connected to the pc, give it a sharename,
such as \\mypc\hpprinter. Then do a redirect of an lpt
port to that sharename: net use LPT2: \\mypc\hpprinter.

This indirect routing through the network driver back to
the local hardware port seems silly, but it did fix a
program that couldn't directly access the hardware.
>
I'm trying to find out if this was some change in
xp from previous versions, or is there something
abnormal going on. I'm trying to avoid setting
up an xp machine for one client.
jim-on-linux


On Saturday 30 December 2006 03:05, Tim Roberts
wrote:
jim-on-linux <in*****@verizon.netwrote:
>Did you run from a file or type in from
keyboard?
>
>When the client runs the utility program the
>output file is built but nothing prints and no
>messages appear. When I typed from keyboard on
an xp pro at c:\, I got the message.
>
>Is it possible that virus detector or some
>self.defense software is interacting?
It is quite possible that they simply do not
have a printer hooked up to their computer's
parallel port. If all of your printers are
from network shares, then the special file
"prn" will not go anywhere.

Typing to "prn" is a dreadful way to do
printing on Windows. --
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Dec 30 '06 #9

P: n/a
jim-on-linux <in*****@verizon.netwrote:
>
Thanks,
The client is in a one printer office. If the
output file is opened with note and then sent to
the printer everything is fine but it defeats the
purpose of the utility. Also tried lpt1 but
the same results.
Is it a USB printer? Remember that "prn" and "lpt1" refer to the first
parallel port, not necessarily the first printer.
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jan 1 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.