Printing

Florian Schulze florian.proff.schulze at gmx.net
Fri Jan 3 12:51:43 EST 2003


On Fri, 03 Jan 2003 03:30:36 GMT darrell <dgallion1 at yahoo.com> wrote:

> import os, re, thread, time, sys
> 
> assoc=os.popen("assoc .pdf").read()
> #'.pdf=AcroExch.Document\012'
> assocA=re.findall("=(.*)\012",assoc)[0]
> ftype=os.popen("ftype %s"%assocA).read()
> #'AcroExch.Document="e:\\sw\\Adobe\\Acrobat 4.0\\Acrobat\\Acrobat.exe" 
> "%1"\012'
> ftypeA=re.findall('=(".*?")', ftype)[0]
> 
> def pdfPrint(fn):
>     cmd= ftypeA.replace("/","\\")+" /p /h " + fn.replace("/","\\")
>     print 'CMD:', cmd
>     os.system(cmd)
> 
> def pdfStart(fn):
>     cmd= ftypeA.replace("/","\\")+" " + fn.replace("/","\\")
>     print "CMD:", cmd
>     thread.start_new_thread (os.system, (cmd,))
> 
> 
> A windows hack
> --Darrell

A Windows2000/XP(/NT?) hack.
It doesn't work on Windows9x(/ME?).

But it's cool. I learn something new on this list every day. And not only
about Python.

Maybe it's possible to get this directly from the registry for both Win9x
and WinNT? This kind of thing should be the same for all Windows versions.

Florian









More information about the Python-list mailing list