Jump to content

Autoit and registry


 Share

Recommended Posts

Hey,

I havn't used autoit in a long time, but today ran into a situation where it would be very helpful.

I'm trying to search for, and edit, all instances of "c:\users" in the registry.

For some reason though, even the simplest scripts don't seem to do anything with the registry open,

IE, Send(^f), which works in all other programs, does nothing if regedit is my main window.

Any idea why that is?

Link to comment
Share on other sites

  • Developers

Hey,

I havn't used autoit in a long time, but today ran into a situation where it would be very helpful.

I'm trying to search for, and edit, all instances of "c:\users" in the registry.

For some reason though, even the simplest scripts don't seem to do anything with the registry open,

IE, Send(^f), which works in all other programs, does nothing if regedit is my main window.

Any idea why that is?

Using Send() with the registry? Why not use the standard REG* functions?

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Using Send() with the registry? Why not use the standard REG* functions?

Jos

Thanks for the quick reply,

From the autoit help, I could only find REG funtions for deleting/modifying/adding, which are all usefull, but I want to find all instances of the text, not just one key.

Link to comment
Share on other sites

  • Developers

Thanks for the quick reply,

From the autoit help, I could only find REG funtions for deleting/modifying/adding, which are all usefull, but I want to find all instances of the text, not just one key.

Did you also see the RegEnum* functions?

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Did you also see the RegEnum* functions?

I'm not sure if these functions will do what I need; I'm don't know what key this line resides in, as it may be in many different places in the registry.

Is there a way to search for a value throughout the entire registry?

Link to comment
Share on other sites

  • Developers

Not sure how fast this will be for you but this is an example how to scan recursively through a RegTree:

Just modify it with testing the result of the RegRead() for what you are looking for.

EnumRegKeys("HKEY_LOCAL_MACHINE\SOFTWARE")
;
Func EnumRegKeys($base)
    Local $i
    ConsoleWrite("Valname #0 under " & $base & ": Default:" & RegRead($base,"") & @CRLF)
    While 1
        $i += 1
        $var = RegEnumVal($base, $i)
        If @error <> 0 then ExitLoop
        ConsoleWrite("Valname #" & $i & " under " & $base & ": " & $var & ":" & RegRead($base,$var) & @CRLF)
    WEnd
    $i = 0
    While 1
        $i += 1
        $var = RegEnumKey($base, $i)
        If @error <> 0 then ExitLoop
;~      ConsoleWrite("SubKey  #" & $i & " under " & $base & ": " & $var & @CRLF)
        EnumRegKeys($base& "\" & $var)
    WEnd
EndFunc
Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Not sure how fast this will be for you but this is an example how to scan recursively through a RegTree:

Just modify it with teting the result of the RegRead() for what you are looking for.

EnumRegKeys("HKEY_LOCAL_MACHINE\SOFTWARE")
;
Func EnumRegKeys($base)
    Local $i
    ConsoleWrite("Valname #0 under " & $base & ": Default:" & RegRead($base,"") & @CRLF)
    While 1
        $i += 1
        $var = RegEnumVal($base, $i)
        If @error <> 0 then ExitLoop
        ConsoleWrite("Valname #" & $i & " under " & $base & ": " & $var & ":" & RegRead($base,$var) & @CRLF)
    WEnd
    $i = 0
    While 1
        $i += 1
        $var = RegEnumKey($base, $i)
        If @error <> 0 then ExitLoop
;~      ConsoleWrite("SubKey  #" & $i & " under " & $base & ": " & $var & @CRLF)
        EnumRegKeys($base& "\" & $var)
    WEnd
EndFunc

Thanks, I'll give it a try!
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...