Sign in to follow this  
Followers 0
thexshadow

regread wildcard

7 posts in this topic

Yes, I know this has been posted before. I have found a few posts on it. I don't really want to use _RegSearch(). I came across: This.

I tried to edit it to my liking, but I couldnt get it to work.

Local $pattern = "[[:xdigit:]]+"
Local $regkey = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno\S9", "Serial_")
If StringRegExp($regkey, $pattern) Then
    MsgBox(64, "Info", "Works")
Else
    MsgBox(16, "Error", "Not working")
EndIf
I do not know the ten numbers following the Serial_. Would anyone know what to do here?

Share this post


Link to post
Share on other sites



If you don't want to use _RegSearch() or your own version of it, you'll have to use RegEnumKey() in a loop and test each name for your pattern.

:mellow:


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

Share this post


Link to post
Share on other sites

I guess I could use _RegSearch(). I just wanted to see if there was anything else. I'll see what I can come up with.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Sorry for the double post. I have played around for a bit and this is what I came up with. But I got stuck on the data, I cant really think of a way to get the data instead of Serial_XXXXXXXXXX. Serial_ is the name, and I need to get the data from it, any ideas? I know it's something simple. I will use RegSearch if it will be easier.

While 1
    $Key = RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno\S9", 1)
    If @error = -1 Then ExitLoop
    If Not @error And StringRegExp($Key, 'Serial_\d') Then
        MsgBox(-1, "", $Key)
        ContinueLoop
    EndIf
WEnd
Edited by thexshadow

Share this post


Link to post
Share on other sites

I meant more like this:

Local $sParentKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno\S9"
For $n = 1 To 1024
    $sValue = RegEnumVal($sParentKey, $n)
    If @error Then ExitLoop
    If StringRegExp($sValue, 'Serial_\d+') Then
        $vData = RegRead($sParentKey, $sValue)
        ConsoleWrite($n & ":  " & $sParentKey & "\" & $sValue & " = " & $vData & @LF)
    EndIf
Next

:mellow:


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

Share this post


Link to post
Share on other sites

Hi, stumbled accross this and it looks like it's what I'm looking for.

How would I take this a little further and make part of the regread a wildcard? You have RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno\S9" If it was maybe S9, S8 or S7.

Share this post


Link to post
Share on other sites

Then the parent key would be "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\rno", and you change the StringRegExp() test to look for what you want. If you don't like the StringRegExp(), just replace it with StringInStr() or some other test as required.

:mellow:


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

Share this post


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
Sign in to follow this  
Followers 0