[python-win32] os.startwith issue dealing with .tif (winxp)
Tim Roberts
timr at probo.com
Fri Aug 29 21:53:10 CEST 2008
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".
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list