Write a program that takes a value from a user and stores it

Write a program that takes a value from a user and stores it in the registry. You can use any key name that you like but also store the current time as another value inside of your new key. Finally, get a directory listing of your current working directory and store that value. You may need to use REG_MULTI_SZ for that value.

Include your attribution block at the top of the program. Make sure you are documenting your program and including preamble comments before any functions that you create. Use self-documenting variable names.

Submit the Python script and a screen capture indicating that the registry entry was created.

Solution

The program that is been used to take the value and stores in the registry is as under..

def OnOk(self, event) // declaring as event in python

data1=self.field1.GetValue() #acceting the value from the user
aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)#connecting to the registry
keyVal=OpenKey(aReg,r\"SOFTWARE\\my path to\\Registry\", 0,KEY_WRITE) # Open the registry key
try:
SetValueEx(keyVal,\"Log file\",0,REG_SZ,data1) #setting the value and the log file
except EnvironmentError:
pass
CloseKey(keyVal) # closing the key value
CloseKey(aReg) # closing the register value

key = OpenKey(REG_MULTI_SZ, r\'Software\\my path to\\Registry\', 0, KEY_READ)#Directory that stores the value and opens it
for i in range(4):
try:
n,v,t = EnumValue(key,i)
if i==0:
self.field2.SetValue(v)
elif i==1:
self.field3.SetValue(v)
elif i==2:
except EnvironmentError:   
pass
CloseKey(key)

Write a program that takes a value from a user and stores it in the registry. You can use any key name that you like but also store the current time as another

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site