Printing

darrell dgallion1 at yahoo.com
Fri Jan 3 04:30:36 CET 2003


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




More information about the Python-list mailing list