ARPFre Posted April 30, 2022 Share Posted April 30, 2022 (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, 2022 by ARPFre Title Link to comment Share on other sites More sharing options...
Solution Danp2 Posted April 30, 2022 Solution Share Posted April 30, 2022 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) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
ARPFre Posted May 2, 2022 Author Share Posted May 2, 2022 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 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