January 26th, 2005, 01:14 PM
Thanks. That link helped a lot. I'm still trying to get it to add my program to a place other than Software, but it's better than nothings, thanks again.I think I figured it out, I know have:
def __init__(self, company="Microsoft", project="Windows\CurrentVersion", write=1):
handle registry access
self.write = write
self.company = company
self.project = project
self.keyname = "Software\\%s\\%s" % (self.company, self.project)
self.key = wreg.OpenKey(wreg.HKEY_CURRENT_USER, self.keyname)
self.key = wreg.CreateKey(wreg.HKEY_CURRENT_USER, self.keyname)
def set(self, name, value):
" set value in registry "
if not self.write:
raise Exception, "registry is read only"
wreg.SetValue(self.key, name, wreg.REG_SZ,str(value))
def pset(self, name, value):
" set using pickle "
def get(self, name):
" get value out of registry "
return wreg.QueryValue(self.key, name)
def pget(self, name):
" get using pickle "
" close the key finally "
r = WindowsRegistry(project="Windows\CurrentVersion", write=1)
r.set("run", "C:\Documents and Settings\Master\Desktop\UOChat.py")
This put my file in CurrentVersion\Run. This should work correctly. I'm just trying to change it's name from (Default) to PythonBot.