Jump to content

Loop within a loop?


Recommended Posts

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:

Link to comment
Share on other sites

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see 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

 

Link to comment
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

Link to comment
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.

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...