Jump to content
Sign in to follow this  
KSagle

Autoit and registry

Recommended Posts

KSagle

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?

Share this post


Link to post
Share on other sites
Jos

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


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
KSagle

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.

Share this post


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

Did you also see the RegEnum* functions?

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
KSagle

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?

Share this post


Link to post
Share on other sites
Jos

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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
KSagle

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!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.