"Michael B. Wright" <[EMAIL PROTECTED]> writes:

> I like to do something like this to register file types...
> 
> (reg.wsf follows)

<snipped>

Or if you don't want to be bother with the scripting host thingies:
(I have commented where the script differs from the scripting host stuff)

(reg.py follows)
from win32com.client import Dispatch
extension = ".test"
progid = "testfile"
type = "text/plain"
appname = "Extension Test"
handler = "\"%windir%\\notepad.exe\" \"%1\""

""" Register the extension """
key = "HKCR\\"+extension+"\\"
Shell = Dispatch("WScript.Shell") # different from wsf
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")
print "all done." # different from wsf

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

-- 

Vennlig hilsen 

Syver Enstad


_______________________________________________
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