Best Python code snippet using fMBT_python
clsregistryutil.py
Source: clsregistryutil.py
1import winreg2class clsregistryutil(object):3 def __init__(self):4 pass5 def SetregistryString(self, regKey, key, Val):6 try:7 hkey = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, regKey, 0, winreg.KEY_ALL_ACCESS)8 winreg.SetValueEx(hkey, key, 0, winreg.REG_SZ, Val)9 hkey.Close()10 except WindowsError:11 print('error SetregistryString')12 def GetregistryString(self, regKey, key):13 hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, regKey, 0, winreg.KEY_ALL_ACCESS)14 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)15 hkey.Close()16 return Val17 def SetregistryDWord(self, regKey, key, Val):18 try:19 hkey = winreg.CreateKeyEx(winreg.HKEY_CURRENT_USER, regKey, 0, winreg.KEY_ALL_ACCESS)20 winreg.SetValueEx(hkey, key, 0, winreg.REG_DWORD, Val)21 hkey.Close()22 except WindowsError:23 print('error SetregistryDWord')24 def GetregistryDWord(self, regKey, key):25 hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, regKey, 0, winreg.KEY_ALL_ACCESS)26 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)27 hkey.Close()28 return Val29 def DeleteKeyregistry(self, regKey):30 try:31 winreg.DeleteKey(winreg.HKEY_CURRENT_USER, regKey)32 except WindowsError:33 print('error DeleteKeyregistry')34 def DeleteValueregistry(self, regKey, key):35 try:36 hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, regKey, 0, winreg.KEY_ALL_ACCESS)37 winreg.DeleteValue(hkey, key)38 hkey.Close()39 except WindowsError:40 print('error DeleteValueregistry')41 def SetregistryStringWOW64(self, regKey, key, Val):42 try:43 hkey = winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, regKey, 0,44 winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)45 winreg.SetValueEx(hkey, key, 0, winreg.REG_SZ, Val)46 hkey.Close()47 except WindowsError:48 print('error SetregistryStringWOW64')49 def GetregistryStringWOW64(self, regKey, key):50 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)51 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)52 hkey.Close()53 return Val54 def SetregistryDWordWOW64(self, regKey, key, Val):55 try:56 hkey = winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, regKey, 0,57 winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)58 winreg.SetValueEx(hkey, key, 0, winreg.REG_DWORD, Val)59 hkey.Close()60 except WindowsError:61 print('error SetregistryDWordWOW64')62 def GetregistryDWordWOW64(self, regKey, key):63 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)64 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)65 hkey.Close()66 return Val67 def DeleteValueregistryWOW64(self, regKey, key):68 try:69 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_WOW64_64KEY | winreg.KEY_ALL_ACCESS)70 winreg.DeleteValue(hkey, key)71 hkey.Close()72 except WindowsError:73 print('error DeleteValueregistryWOW64')74 def SetregistryString32(self, regKey, key, Val):75 try:76 hkey = winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_ALL_ACCESS)77 winreg.SetValueEx(hkey, key, 0, winreg.REG_SZ, Val)78 hkey.Close()79 except WindowsError:80 print('error SetregistryString32')81 def GetregistryString32(self, regKey, key):82 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_ALL_ACCESS)83 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)84 hkey.Close()85 return Val86 def SetregistryDWord32(self, regKey, key, Val):87 try:88 hkey = winreg.CreateKeyEx(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_ALL_ACCESS)89 winreg.SetValueEx(hkey, key, 0, winreg.REG_DWORD, Val)90 hkey.Close()91 except WindowsError:92 print('error SetregistryDWord32')93 def GetregistryDWord32(self, regKey, key):94 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_ALL_ACCESS)95 Val = winreg.QueryValueEx(hkey, key)[0] # Val = winreg.QueryValueEx(hkey, key)96 hkey.Close()97 return Val98 def DeleteKeyregistry32(self, regKey):99 try:100 winreg.DeleteKey(winreg.HKEY_LOCAL_MACHINE, regKey)101 except WindowsError:102 print('error DeleteKeyregistry32')103 def DeleteValueregistry32(self, regKey, key):104 try:105 hkey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, regKey, 0, winreg.KEY_ALL_ACCESS)106 winreg.DeleteValue(hkey, key)107 hkey.Close()108 except WindowsError:109 print('error DeleteValueregistry32')110if __name__ == '__main__':111 clsobj = clsregistryutil()112 """113 clsobj.SetregistryString32("Software\\Daeseong\\Daeseong", "GameList", "3")114 counter = clsobj.GetregistryString32("Software\\Daeseong\\Daeseong", "GameList")115 print(counter)116 clsobj.SetregistryDWord32("Software\\Daeseong\\Daeseong", "Gamekey1", 1)117 counter = clsobj.GetregistryDWord32("Software\\Daeseong\\Daeseong", "Gamekey1")118 print(counter)119 """120 """121 clsobj.DeleteValueregistry32("Software\\Daeseong\\Daeseong", "Gamekey1")122 clsobj.DeleteKeyregistry32("Software\\Daeseong\\Daeseong")123 clsobj.DeleteKeyregistry32("Software\\Daeseong")124 """125 """126 clsobj.SetregistryStringWOW64("Software\\Daeseong\\Daeseong", "GameList", "3")127 counter = clsobj.GetregistryStringWOW64("Software\\Daeseong\\Daeseong", "GameList")128 print(counter)129 clsobj.SetregistryDWordWOW64("Software\\Daeseong\\Daeseong", "Gamekey1", 1)130 counter = clsobj.GetregistryDWordWOW64("Software\\Daeseong\\Daeseong", "Gamekey1")131 print(counter)132 """133 # clsobj.DeleteValueregistryWOW64("Software\\Daeseong\\Daeseong", "Gamekey1")134 """135 clsobj.SetregistryString("Software\\Daeseong\\Daeseong", "GameList", "3")136 counter = clsobj.GetregistryString("Software\\Daeseong\\Daeseong", "GameList")137 print(counter)138 clsobj.SetregistryDWord("Software\\Daeseong\\Daeseong", "Gamekey1", 1)139 counter = clsobj.GetregistryDWord("Software\\Daeseong\\Daeseong", "Gamekey1")140 print(counter)141 """142 """143 clsobj.DeleteValueregistry("Software\\Daeseong\\Daeseong", "Gamekey1")144 clsobj.DeleteKeyregistry("Software\\Daeseong\\Daeseong")145 clsobj.DeleteKeyregistry("Software\\Daeseong")146 """...
ToontownDummyLauncher.py
Source: ToontownDummyLauncher.py
...32 def getUserName(self):33 return 'dummy'34 def getReferrerCode(self):35 return None36 def setRegistry(self, name, value):37 print 'setRegistry[%s] = %s' % (name, value)38 self.reg[name] = value39 def getRegistry(self, name, defaultValue = None):40 if name in self.reg:41 value = self.reg[name]42 else:43 value = defaultValue44 print 'getRegistry[%s] = %s' % (name, value)45 return value46 def getGame2Done(self):47 return 148 def recordPeriodTimeRemaining(self, secondsRemaining):49 self.setRegistry(self.periodTimeRemainingKey, secondsRemaining)50 def recordPeriodName(self, periodName):51 self.setRegistry(self.periodNameKey, periodName)52 def recordSwid(self, swid):53 self.setRegistry(self.swidKey, swid)54 def getGoUserName(self):55 return self.goUserName56 def setGoUserName(self, userName):57 self.goUserName = userName58 def getParentPasswordSet(self):59 return 060 def getNeedPwForSecretKey(self):...
Check out the latest blogs from LambdaTest on this topic:
Collecting and examining data from multiple sources can be a tedious process. The digital world is constantly evolving. To stay competitive in this fast-paced environment, businesses must frequently test their products and services. While it’s easy to collect raw data from multiple sources, it’s far more complex to interpret it properly.
Hola Testers! Hope you all had a great Thanksgiving weekend! To make this time more memorable, we at LambdaTest have something to offer you as a token of appreciation.
When I started writing tests with Cypress, I was always going to use the user interface to interact and change the application’s state when running tests.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!