win32 screen captures

Darrell dgallion1 at yahoo.com
Sun Aug 12 11:57:00 EDT 2001


Robin Becker wrote:
> I have also managed to get a PDF App to pop up using COM directly, but
> can't seem to get an open document into it, whine
> 

Untested code cut from another app:

import os, re, thread, sys

assoc=os.popen("assoc .pdf").read()
assocA=re.findall("=(.*)\012",assoc)[0]
ftype=os.popen("ftype %s"%assocA).read()
ftypeA=re.findall('=(".*?")', ftype)[0]

def pdfPrint(fn):
    cmd= ftypeA.replace("/","\\")+" /p /h " + fn.replace("/","\\")
    os.system(cmd)

def pdfStart(fn):
    cmd= ftypeA.replace("/","\\")+" " + fn.replace("/","\\")
    # Add 'start' to the command then cmd won't block on NT. 
    thread.start_new_thread (os.system, (cmd,))

if __name__=="__main__":
    pdfPrint('xxx.pdf')



--Darrell



More information about the Python-list mailing list