ARPFre 0 Posted April 30 Share Posted April 30 (edited) Thank you all for the help and teaching on this forum. I'm having a really hard time using Ubond and Regex together. I'm trying to look inside the registry: HKEY_LOCAL_MACHINE\SYSTEM\Setup Where the full key is : HKEY_LOCAL_MACHINE\SYSTEM\Setup\Source OS (Updated on 3/24/2022 20:34:53) Source OS always remains static. how many times the "Source OS" Key appears and list the full key name in a Message Box, Array, or whatever. I've tried many things, where it stops saying that the Variable cannot be used. I'm stuck. Can you help me please. I know it sounds simple, but I couldn't. Local $sSubKey = "", $sEnumKey = "under HKLM\SOFTWARE:" & @CRLF & @CRLF For $i = 1 To 10 $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\Setup\", $i) $Compare = $sSubKey(StringRegExp($sSubKey,"Source OS+(.*)$")) If $sSubKey = $Compare then MsgBox(0,0,$sSubKey,0) EndIf If @error Then ExitLoop $sEnumKey &= "#" & $i & @TAB & $sSubKey & @CRLF Next MsgBox($MB_SYSTEMMODAL, "RegEnumKey Example", $sEnumKey) Edited April 30 by ARPFre Title Link to post Share on other sites
Solution Danp2 1,277 Posted April 30 Solution Share Posted April 30 Maybe this will help you -- #include <MsgBoxConstants.au3> Local $sSubKey = "", $sEnumKey = "under HKEY_LOCAL_MACHINE\SYSTEM\Setup\:" & @CRLF & @CRLF Local $i = 0 While True $i += 1 $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\Setup\", $i) If @error Then ExitLoop If StringRegExp($sSubKey,"Source OS+(.*)$") Then $sEnumKey &= "#" & $i & @TAB & $sSubKey & @CRLF EndIf WEnd MsgBox($MB_SYSTEMMODAL, "RegEnumKey Example", $sEnumKey) WebDriver UDF [GH&S] Latest version Wiki FAQs Link to post Share on other sites
ARPFre 0 Posted May 2 Author Share Posted May 2 On 4/30/2022 at 3:34 PM, Danp2 said: Maybe this will help you -- #include <MsgBoxConstants.au3> Local $sSubKey = "", $sEnumKey = "under HKEY_LOCAL_MACHINE\SYSTEM\Setup\:" & @CRLF & @CRLF Local $i = 0 While True $i += 1 $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\Setup\", $i) If @error Then ExitLoop If StringRegExp($sSubKey,"Source OS+(.*)$") Then $sEnumKey &= "#" & $i & @TAB & $sSubKey & @CRLF EndIf WEnd MsgBox($MB_SYSTEMMODAL, "RegEnumKey Example", $sEnumKey) Thank you it worked correctly!!! I got pretty close, but I was missing something that I'm going to analyze your code in detail to learn. Link to post Share on other sites
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