I like to do something like this to register file types...

(reg.wsf follows)


<?xml version="1.0" standalone="yes"?>
<?job error="yes" debug="no" ?>
<package>
        <job id="default">
                <runtime>
                        <description><![CDATA[Script to register a file type
(reg.wsf)]]></description>
                        <example><![CDATA[ ]]></example>
                </runtime>
                <script language="Python">
<![CDATA[

extension = ".test"
progid = "testfile"
type = "text/plain"
appname = "Extension Test"
handler = "\"%windir%\\notepad.exe\" \"%1\""

""" Register the extension """
key = "HKCR\\"+extension+"\\"
Shell = WScript.CreateObject("WScript.Shell")
Shell.RegWrite(key, progid)
Shell.RegWrite(key + "\\Content Type", type)

""" Register the ProgID """
key = "HKCR\\"+progid+"\\"
Shell.RegWrite(key, appname)
Shell.RegWrite(key + "\\shell\\action\\command\\", handler, "REG_EXPAND_SZ")
Shell.RegWrite(key + "\\DefaultIcon\\",
"\"%SystemRoot%\\system32\\shell32.dll\",-152", "REG_EXPAND_SZ")
WScript.echo("all done.")

""" Notify the shell that we made a change """
from win32com.shell import shell
shell.SHChangeNotify(0x08000000L, 0, None, None)

]]>
                </script>
        </job>
</package>




-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Warnes,
Gregory R
Sent: Friday, June 21, 2002 5:17 AM
To: '[EMAIL PROTECTED]'
Subject: How to set mime-type/file association in registry


Can someone provide example code for setting the file association and mime
type from python under W2K?

Thanks,

Greg


LEGAL NOTICE
Unless expressly stated otherwise, this message is confidential and may be
privileged. It is intended for the addressee(s) only. Access to this E-mail
by anyone else is unauthorized. If you are not an addressee, any disclosure
or copying of the contents of this E-mail or any action taken (or not taken)
in reliance on it is unauthorized and may be unlawful. If you are not an
addressee, please inform the sender immediately.
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to