473,890 Members | 1,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Easiest way to print from XP/DOS.



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
9 1459
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

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
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
jim-on-linux <in*****@verizo n.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
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


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*****@verizo n.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

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

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\hpprinte r. Then do a redirect of an lpt
port to that sharename: net use LPT2: \\mypc\hpprinte r.

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*****@verizo n.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
jim-on-linux <in*****@verizo n.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
11443
by: J Sharman | last post by:
What is the easiest way to import an XML Datafeed from a URL into a MYSQL Database? Possibly using PHP Regards Joe PS Please answer to group and joe@joesharman.co.uk
7
11538
by: Rolf Hemmerling | last post by:
Hello ! Beginner's question: What ist the easiest way to store and save objects in a file generated by a C++ program, by using the "standard C++ library" and/or "Standard Template Library ( STL )" ? So I would like to generate some objects ( of different classes ) with a C++ program and would like to make it permanent / persistent, so that
7
2698
by: Dan V. | last post by:
Situation: I have to connect with my Windows 2000 server using VS.NET 2003 and C# and connect to a remote Linux server at another company's office and query their XML file. Their file may be updated every hour or so. How can I do this easily? I would like to use secure communication even encryption if possible. I would query and insert locally only the newest records found in that XML file to an xml or MS access db.
3
3805
by: DBQueen | last post by:
I have a form with lines of controls. On some of the lines there are 3 controls (call them A,B,C); other lines have only control A. The controls have been numbered sequentially (Q20, Q21....Q76) and they were put onto the form in the numerical sequence. I have given the A's with B & C's on the same line a tag=1; B.tag=2, C,tag=2) I am trying to write 2 modules so that the following occurs (on Form_Current and 'A' Control_Before or...
8
2709
by: DanB | last post by:
This is probably soooo simple but I can't seem to get it. I have a text file that I want users to download via a web page. I want the file to be saved to a default folder (or one that they choose) on the users / client file system. I have toyed with a Self-Extracting zip file but the contents of my zip file changes each time it is downloaded so that invalidates the exe file. Also the text file is so small it is a waste to zip it.
7
2396
by: P. Schmidt-Volkmar | last post by:
Hi there, I have a string in which I want to calculate how often the character ';' occurs. If the character does not occur 42 times, the ";" should be added so the 42 are reached. My solution is slow and wrong: for Position in range (0, len(Zeile)): if Zeile==';': AnzahlSemikolon = AnzahlSemikolon +1 if AnzahlSemikolon < 42:
6
1881
by: QQ | last post by:
I have a string A I'd like to print A except for for(i=offset-1;i<100;i++) printf("%c",A); or introduce a new variable like B memcpy(B,&A,100-offset) printf("%s",B); What's the easiest way to do it?
6
1754
by: k04jg02 | last post by:
Problem: I have a properties dialog. X objects build the dialog, but a subclass of X, such as Y, can add more options to the dialog for Y specific properties. I would like to write code for the dialog that creates a backup of the current object when the dialog pops up, and sets the current modified object to the backup when the user clicks cancel (or discards the backup if the user clicks OK). X already has a Clone method.
5
2193
by: gnewsgroup | last post by:
In my user control, I would like to find a Label control in the parent page (the page that uses my user control). I need to update that Label.Text when something happens in the user control. I don't want to go through the hassle of creating events in the user control, and then let the parent handle the event. What is the easiest way to find a control in the parent page? Right now, I am simply manually traversing it from the user...
0
9976
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11214
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10801
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8006
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5834
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4659
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4257
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3266
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.