Jump to content

Help with Ubond, Regex and RegRead together.


Go to solution Solved by Danp2,

Recommended Posts

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 by ARPFre
Title
Link to post
Share on other sites
  • ARPFre changed the title to Help with Ubond, Regex and RegRead together.
  • Solution

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)

 

Link to post
Share on other sites
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...