[python-win32] os.startwith issue dealing with .tif (winxp)

geoff imageguy1206 at gmail.com
Sat Aug 30 04:11:27 CEST 2008


On Fri, Aug 29, 2008 at 4:53 PM, Tim Roberts <timr at probo.com> wrote:
> geoff wrote:
>> Hi Folks;
>>
>> I have an application that stores images in a database.
>> When the images are extracted, we use the files extension and
>> os.startwith("filename") to allows the OS to select the users
>> desingated program to open the file.
>>
>> Sometimes ... this goes astray.  For some mysterious reason, WinXP's
>> file type associates get removed, atleast for TIF files.
>>
>
> TIFF files are not normally associated with a program on Windows XP.
>
>> what I would like to do is that if os.startwith fails, try to open the
>> file with a specific program.  In the case of image files, the Ms
>> Picture and Fax Viewer.
>>
>> How do I find the default path to an installed program ?
>> Do I need the GUID and then look for the registry key ??
>>
>
> No, that doesn't work for applications, only for COM objects.
>
> However, in this specific case, you are in luck.  The "Microsoft Picture
> and FAX Viewer" happens to live inside of a system DLL, and that DLL
> always lives in the Windows "system32" directory.  So, you can do this:
>    rundll32.exe shimgvw.dll,ImageView_Fullscreen path\to\image\file.tiff
>
> Whitespace is important; don't put any before or after that "comma".
>
Thanks for that tip Tim.
Can you point me in the right direction as to how to associate the MS
Picture and FAX Viewer" as the associated program for TIFs ?

g.

BTW: it is os.startfile("path to file name") NOT os.startwith  -- the
mistake was mine, but thanks for understanding the meaning.


More information about the python-win32 mailing list