Sign in to follow this  
Followers 0
mtmartis

Loop within a loop?

4 posts in this topic

I need to search for a particular uninstall value in HKLM\Software\Microsoft\Windows\Currentversion\Uninstall since the subkey under \Uninstall are mainly GUIDs. I can't just unin

I guess I would have to run a loop to enumerate all Keys under \Uninstall then for each of those, run another loop to enumerate all the values , then search all the values for the program I am looking for, once it's found it, it would report back the value I needed. I have attached an image to better explain my goal. post-53166-12799145503075_thumb.jpg

So in starting, I figured I would try enumerating all subkeys, then all values in the subkeys...

For $a= 1 to 10
    $MainKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CurrentVersion\Uninstall\"
    $var1 = RegEnumKey($MainKey, $a)
    If @error <> 0 then ExitLoop
    MsgBox(4096, "SubKey #" & $a & " under HKLM\Software\Test: ", $var1)
    
    For $b= 1 to 10
        $var2 = RegEnumVal($MainKey & "\" & $a, $b)
        If @error <> 0 then ExitLoop
    MsgBox(4096, "Value #" & $b & " under" & $var1, $var2)
    Next
Next

The first loop runs, but the second does not. I am not sure if I need to read the values into an array first?

Or perhaps I for each subkey the first loop goes through, do a String in String?

Anyone able to point me in the right direction of which command I should use?

Yes, I do know your question if I am a newb was rhetorical :blink:

Share this post


Link to post
Share on other sites



mtmartis,

As you apparently did not notice the sign above which says:

This is not a general support forum!

I have asked for this to be transferred. :blink:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

For $a= 1 to 10
    $MainKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\CurrentVersion\Uninstall\"
    $var1 = RegEnumKey($MainKey, $a)
    If @error <> 0 then ExitLoop
    MsgBox(4096, "SubKey #" & $a & " under HKLM\Software\Test: ", $var1)

    $b = 10
    Do
        $var2 = RegEnumVal($MainKey & "\" & $a, $b)
        If @error <> 0 then ExitLoop
        MsgBox(4096, "Value #" & $b & " under" & $var1, $var2)
        $b += 1
    Until $b = 10
Next

Share this post


Link to post
Share on other sites

Do the key names really change with each installation of the program? I was thinking that these GUIDs are fixed for a given program (InstallShield calculating some hash value..? But then, what about the next patch of that program, still same GUID?)

If they were fixed, you could read the key, and compare DisplayName against the program name you expect there to be.

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