<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Hi Greg,<br>
<br>
On 1:59 PM, Roberts, Gregory (Contractor) wrote:
<blockquote
 cite="mid:%3C2ABF676708495B4AB7162B8C1BC6185A0462780E@WDCEXG06.usmint.etreas.gov%3E"
 type="cite">
  <pre wrap="">
We have decided to oset the default printer in a macro which we must run
on the excel report and hope that all will work on Monday when in
production.

I would like to find a python solution which I could refactor into the
correct place.  Again, my wits with Python still have not formed.
Also... I am unable to dedicate to much time to this task for the time
being.

Thanks for the suggestions.  I will try and think outside the box using
them as guidance.

Greg


  </pre>
</blockquote>
<br>
I'm not sure why the other PyWin32 guys didn't mention this, but you
can do either of the following:<br>
<br>
<pre class="python"><span
 style="color: rgb(255, 119, 0); font-weight: bold;">import</span> win32print
win32print.<span style="color: black;">SetDefaultPrinter</span><span
 style="color: black;">(</span><span style="color: rgb(72, 61, 139);">'My Printer Name'</span><span
 style="color: black;">)

</span><span style="color: rgb(255, 119, 0); font-weight: bold;">import</span> <span
 style="color: rgb(220, 20, 60);">subprocess</span>
<span style="color: rgb(220, 20, 60);">subprocess</span>.<span
 style="color: black;">call</span><span style="color: black;">(</span>r<span
 style="color: rgb(72, 61, 139);">'rundll32 printui.dll PrintUIEntry /y /n <span
 style="color: rgb(0, 0, 153); font-weight: bold;">\\</span>UNC<span
 style="color: rgb(0, 0, 153); font-weight: bold;">\p</span>ath<span
 style="color: rgb(0, 0, 153); font-weight: bold;">\t</span>o<span
 style="color: rgb(0, 0, 153); font-weight: bold;">\p</span>rinter'</span><span
 style="color: black;">)</span>
</pre>
<br>
I have a couple of other tips here:
<a class="moz-txt-link-freetext" href="http://www.blog.pythonlibrary.org/2010/02/14/python-windows-and-printers/">http://www.blog.pythonlibrary.org/2010/02/14/python-windows-and-printers/</a>&nbsp;
and Tim Golden's site has at least one other script based on printers:<br>
<a class="moz-txt-link-freetext" href="http://timgolden.me.uk/python/wmi/cookbook.html#show-print-jobs">http://timgolden.me.uk/python/wmi/cookbook.html#show-print-jobs</a>
(although it has nothing to do with what you're doing).<br>
<br>
The other guys had good suggestions too though.<br>
<br>
<br>
<div class="moz-signature">-- <br>
<strong>Mike Driscoll</strong>
<p>Blog: <a class="moz-txt-link-freetext" href="http://blog.pythonlibrary.org">http://blog.pythonlibrary.org</a>
</p>
</div>
</body>
</html>