blender Posted January 25, 2008 Share Posted January 25, 2008 Hi, all I need to obtain the name of a reg key for an application under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall". However, name of the regkey is random everytime I install the program. The only thing consistant is the value of a sub regkey "InstallLocation" under that regkey and the value is known. (So the value of the regkey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{xxxxx}\InstallLocation" is known for me. But {xxxx} is random) Is there a way for me to obtain the name of the regkey ({xxxx}) by only knowing the value of its sub-regkey? I tried RegEnumKey, but it doesn't seem to work in my case. Thanks Link to comment Share on other sites More sharing options...
lsakizada Posted January 25, 2008 Share Posted January 25, 2008 (edited) Hi, all I need to obtain the name of a reg key for an application under "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall". However, name of the regkey is random everytime I install the program. The only thing consistant is the value of a sub regkey "InstallLocation" under that regkey and the value is known. (So the value of the regkey "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{xxxxx}\InstallLocation" is known for me. But {xxxx} is random) Is there a way for me to obtain the name of the regkey ({xxxx}) by only knowing the value of its sub-regkey? I tried RegEnumKey, but it doesn't seem to work in my case. Thanks Maybe this way if you have clue about the random one: For $i= 1 to 100 $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $i) If @error <> 0 then ExitLoop If StringInStr ( $var, "xxxx" ) Then MsgBox(4096, "SubKey #" & $i & " HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall: ", $var) EndIf Next Otherwise: Put the $var values into array and then loop through the subregs to get the value from the InstallLocation. When it is found then use the RegEnumKey to get the value of the desired regkey. Edited January 25, 2008 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
blender Posted January 25, 2008 Author Share Posted January 25, 2008 Maybe this way if you have clue about the random one: For $i= 1 to 100 $var = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", $i) If @error <> 0 then ExitLoop If StringInStr ( $var, "xxxx" ) Then MsgBox(4096, "SubKey #" & $i & " HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall: ", $var) EndIf Next Otherwise: Put the $var values into array and then loop through the subregs to get the value from the InstallLocation. When it is found then use the RegEnumKey to get the value of the desired regkey. Thank you very much. I solved the problem. I have another stupid question now. How do I break out of a loop? Break function looks different from it's in other languages. Link to comment Share on other sites More sharing options...
weaponx Posted January 25, 2008 Share Posted January 25, 2008 Thank you very much. I solved the problem. I have another stupid question now. How do I break out of a loop? Break function looks different from it's in other languages.Its in the helpfile, just like everything else.http://www.autoitscript.com/autoit3/docs/k...ontinueLoop.htmhttp://www.autoitscript.com/autoit3/docs/k...ds/ExitLoop.htm Link to comment Share on other sites More sharing options...
blender Posted January 25, 2008 Author Share Posted January 25, 2008 Its in the helpfile, just like everything else.http://www.autoitscript.com/autoit3/docs/k...ontinueLoop.htmhttp://www.autoitscript.com/autoit3/docs/k...ds/ExitLoop.htmI checked the function reference and it's not there. Didn't know it's in the keyword section. Thanks for the help!! Link to comment Share on other sites More sharing options...
PsaltyDS Posted January 25, 2008 Share Posted January 25, 2008 One of the really good looking birds on this forum posted a recursive registry search fuction: _RegSearch() Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
lsakizada Posted January 26, 2008 Share Posted January 26, 2008 One of the really good looking birds on this forum posted a recursive registry search fuction: _RegSearch() PsaltyDS ! Thanks for sharing and mentioning this function. It is very useful for me Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now