win32 screen captures

Tim Roberts timr at probo.com
Mon Aug 13 02:44:36 CEST 2001


dgallion1 at yahoo.com (Darrell) wrote:

>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]

Unfortunately, "assoc" and "ftype" are on Windows NT only.  They aren't
available on Win98 or, of course, Unix.

You can achieve the same end on all Windows systems with
win32api.ShellExecute.
--
- Tim Roberts, timr at probo.com
  Providenza & Boekelheide, Inc.



More information about the Python-list mailing list