September 28th, 2005, 09:57 AM
|
#1 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
| using a python script to install a printer
Hey, im trying to install a printer using a python script. I actually have it working and it does install, but i am using a very very slow working os.popen script: Code: os[dot]popen(<windir section>\\system32\\rundll32.exe printui.dll,<PrintUIEntry> /if /b \"%s\" /f windir_section\inf\ntprint.inf /r \"\\\<print server location here>\\<printer name>\" /m \"%s\" /u /z" % (cmd, Printer_Description, Driver_Name)) This part of the code works, but it looks like it freezes my program due to taking too long. I have tried to look into python modules that can do this for me..I found a possibility of using a win32com module based on an M$ site: http://www.microsoft.com/technet/scr.../prpopy01.mspx
I hear that the win32com modules are security risks due to the ActiveX/ActiveState? scripts...should I avoid using this library?
Thanks
edit: wonder why its pulling up that weird tag in the recent discussion box...
Last edited by engineuity : September 28th, 2005 at 10:44 AM.
|
| |
September 28th, 2005, 10:10 AM
|
#2 (permalink)
| | Ultimate Member
Join Date: Aug 2004 Location: Lancaster, PA
Posts: 1,550
|
The tag just keeps getting worse. 
__________________
This is a +10 Post of Awesomeness. It is impervious to rebuttal, factual inaccuracies, and logical inconsistencies. Opinions expressed are 100% truth.
|
| |
September 28th, 2005, 10:15 AM
|
#3 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
|
i know...i tried taking out the [code] tags and putting <> around the whole thing (the <windir> "phrase" is hidden from there), tried html comment <!-- --> and // ... |
| |
September 28th, 2005, 10:21 AM
|
#4 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
|
ok i give up on trying to fix that...the code looks mangled now, but the recent discussions look better. lol |
| |
October 4th, 2005, 10:59 AM
|
#5 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
|
bump...
nobody has any suggestions? |
| |
October 5th, 2005, 10:33 AM
|
#6 (permalink)
| | Member
Join Date: Jan 2004
Posts: 242
|
...just in case
instead of using os.popen, there is a win32print library that can be used in python: Code: win32print.AddPrinterConnection(\\<server>\<printer>) Does anyone know how to use win32print.EnumPrinters? |
| | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | |
Posting Rules
| You may post new threads You may post replies You may not post attachments You may not edit your posts HTML code is Off | | | | Most Active Discussions | | | | | Recent Discussions  | | | | | |