Sign in to follow this  
Followers 0
Chimaera

Read array into registry

44 posts in this topic

#1 ·  Posted (edited)

Im messing with a number of registry keys which i want to check a value i.e DisplayName

If this is present and matches then give me back the uninstaller options

with QuietUninstallString and after that UninstallString

#include <Array.au3>
global $value
$regkey = 'CCleaner' ;{840C85B7-D3D6-4143-9AF9-DAE80FD54CFC}
$DisplayName = 'DisplayName'

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey

Global $aRegKeys = StringSplit($sRegPath, "|")
_ArrayDisplay( $aRegKeys)

For $i = 1 To $aRegKeys[0]
    RegRead($aRegKeys[$i], $DisplayName)
    If @error <> 0 Then
        ConsoleWrite(@error & @CRLF)
    Else
        If $DisplayName = $regkey Then
            Switch $value
                Case 1
                    $value = RegRead($aRegKeys[$i], 'QuietUninstallString')
                Case 2
                    $value = RegRead($aRegKeys[$i], 'UninstallString')
            EndSwitch
                ConsoleWrite($DisplayName & @CRLF)
            Sleep(100)
        EndIf
    EndIf
Next 

It shows the array correctly but then when it goes through the loops im missing an element

It gives me an error 1 4 times?

which is unable to open requested key

A little help please

Edited by Chimaera

Share this post


Link to post
Share on other sites



Hmm i don't have ccleaner installed, so i assume that's why i don't get any error.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Found some errors, example:

$DisplayName = DisplayName

you never set it to be anything else

so its never equal to $regkey

So it never gets past there..

EDIT: this works for me, i know switch works too, i just don't like it much.

#include <Array.au3>
global $value
$regkey = 'CCleaner' ;{840C85B7-D3D6-4143-9AF9-DAE80FD54CFC}
$DisplayName = 'DisplayName'

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey

Global $aRegKeys = StringSplit($sRegPath, "|")
_ArrayDisplay( $aRegKeys)

For $i = 1 To $aRegKeys[0]
    $Read = RegRead($aRegKeys[$i], $DisplayName) ;Get this value and use it bellow.
    If @error <> 0 Then
        ConsoleWrite('Error '&$i&' = '&@error & @CRLF)
    Else
        If $Read = $regkey Then ;<<<Here
                    $value = RegRead($aRegKeys[$i],'QuietUninstallString')
                    If @error = 0 Then
                        ConsoleWrite('$value '&$i&' = '&$value & @CRLF)
                    EndIf
                    $value = RegRead($aRegKeys[$i],'UninstallString')
                    If @error = 0 Then
                        ConsoleWrite('$value '&$i&' = '&$value & @CRLF)
                    EndIf
            Sleep(100)
        EndIf
    EndIf
Next
Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Thats getting closer thx

Ive amended it slightly as i only want the best uninstall key returned

#include <Array.au3>
Global $value
$regkey = '{26A24AE4-039D-4CA4-87B4-2F83217055FF}' ;{A92DAB39-4E2C-4304-9AB6-BC44E68B55E2}
$DisplayName = 'DisplayName'

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey & '|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $regkey

Global $aRegKeys = StringSplit($sRegPath, "|")
;~ _ArrayDisplay( $aRegKeys)

For $i = 1 To $aRegKeys[0]
    $Read = RegRead($aRegKeys[$i], $DisplayName) ;Get this value and use it below.
    If @error <> 0 Then
        ConsoleWrite('Error ' & $i & ' = ' & @error & @CRLF)
    Else
        If $Read = $regkey Then ;<<<Here
                    $value = RegRead($aRegKeys[$i],'QuietUninstallString')
                    If @error = 0 Then
                        ConsoleWrite('$value '&$i&' = '&$value & @CRLF)
                    Else
            $value = RegRead($aRegKeys[$i],'UninstallString')
            If @error = 0 Then ConsoleWrite('$value '&$i&' = '&$value & @CRLF)
                    EndIf
            Sleep(100)
        EndIf
    EndIf
Next

One thing ive noticed if i use the folder names to search for like the one in the code above its Java uninstall btw

The 2nd and 4th search fails?, is it the brackets?

Edited by Chimaera

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Hi, not sure what you mean by "if i use the folder names to search for like the one in the code above".

You mean it's failing for java? and we're talking about registry folders right? sorry, my lack of concentration takes the best of me.

EDIT: got what you mean, for me, java is:

HKEY_LOCAL_MACHINESOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall{26A24AE4-039D-4CA4-87B4-2F83217051FF}

Are those brackets what you are reffering to? Im going to investigate that.

EDIT:

For the ccleaner case it worked, because 'DisplayName' was same name of the folder of keys..

in this case, when you compare $Read = $regkey, it will not read {26A24AE4-039D-4CA4-87B4-2F83217051FF} for me it will read Java 7 Update 55, thus, getting a difference, and exits.

Or am i totally wrong in what i understood as the problem?

Edit: the more i look into this, the less i understand why you are comparing those 2 "If $Read = $regkey Then"

I mean, you check for error uppon the read of the key, so why this afterwards?

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Yep i think thats right

Basically i am going to search out an array of Registry folder names as searching for the display name still requires the folder name

Once i have the folder names i will feed them into this code as $regkey

And it will spit out the best uninstaller for each case, which i will then feed to some uninstaller routines which i havent done yet to mass uninstall a set number of products

Doing it this way should give me the right uninstaller on different machines

DisplayName should give me what the uninstaller name is in Programs and Features but i think im going to have to manually build my registry folder list to get it right

Edited by Chimaera

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

DisplayName should give me what the uninstaller name is in Programs and Features but i think im going to have to manually build my registry folder list to get it right

 

yeah, and it does, the issue is just that, sometimes the folder name is different from the DisplayName, if you remove that compare, it works all the time, you don't need it.

The thing you could do to skip the manual work, is to search for all "DisplayName" under each "uninstall" folder, and whenever it hits,

uninstall, in this manner you only had to write the display name, and not worry about the folders.

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

The condition  If $Read = $regkey Then will never match, because you are trying to compare the DisplayName with the Key name...

I think you can remove this condition, no ? If you are not sure about the key name, use RegEnumKey to search a matching DisplayName

Share this post


Link to post
Share on other sites

yeah, and it does, the issue is just that, sometimes the folder name is different from the DisplayName, if you remove that compare, it works all the time, you don't need it.

The thing you could do to skip the manual work, is to search for all "DisplayName" under each "uninstall" folder, and whenever it hits,

uninstall, in this manner you only had to write the display name, and not worry about the folders.

Ok ill look at removing it then or searching a different way

The condition  If $Read = $regkey Then will never match, because you are trying to compare the DisplayName with the Key name...

I think you can remove this condition, no ? If you are not sure about the key name, use RegEnumKey to search a matching DisplayName

i had a look at regEnumKey and it ignores the folders like {26A24AE4-039D-4CA4-87B4-2F83217055FF} like the other code does

Share this post


Link to post
Share on other sites

i had a look at regEnumKey and it ignores the folders like {26A24AE4-039D-4CA4-87B4-2F83217055FF} like the other code does

Sorry, but are you sure ?

 

#Include <Array.au3>

Local $sSearch = 'AutoIt'
Local $aResult[1][3]

Local $aKeys[5] = ["HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall", _
                   "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", _
                   "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", _
                   "HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall", _ 
                   "HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ]

For $i = 0 To UBound($aKeys) - 1
    Local $sDisplayName, $sUninstallString
    Local $iIndex = 1, $sKey
    
    While 1
        $sKey = RegEnumKey($aKeys[$i], $iIndex)
        If @error Then ExitLoop
        
        $sDisplayName = RegRead($aKeys[$i] & "\" & $sKey, "DisplayName")
        $sUninstallString = RegRead($aKeys[$i] & "\" & $sKey, "UninstallString")
        
        Redim $aResult[ UBound($aResult) + 1][3]
        $aResult[ UBound($aResult) - 1][0] = $aKeys[$i] & "\" & $sKey
        $aResult[ UBound($aResult) - 1][1] = $sDisplayName
        $aResult[ UBound($aResult) - 1][2] = $sUninstallString

        $iIndex += 1
    WEnd
Next

_ArrayDisplay($aResult)

Share this post


Link to post
Share on other sites

Good job jguinch!


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Only just seen that jguinch very advanced ..

I was making changes today based on your suggestions and i ended up with this

#include <Array.au3>

$sRegKey = '{26A24AE4-039D-4CA4-87B4-2F83217055FF}'

$StringFirst = "QuietUninstallString"
$StringSecond = "UninstallString"

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\' & $sRegKey & '|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $sRegKey & '|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $sRegKey & '|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\' & $sRegKey & '|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\' & $sRegKey
Global $aRegPath = StringSplit($sRegPath, "|")
_ArrayDisplay( $aRegPath)

For $i = 1 To $aRegPath[0]
    If _IsRegistryExist($aRegPath[$i] , $StringFirst) = 1 Then
        $UninstallPath = RegRead($aRegPath[$i], $StringFirst)
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    ElseIf _IsRegistryExist($aRegPath[$i], $StringSecond) = 1 Then
        $UninstallPath = RegRead($aRegPath[$i], $StringSecond)
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    Else
        ConsoleWrite('Path Could Not Be Found' & @CRLF)
    EndIf
Next

Func _IsRegistryExist($sKeyName, $sValueName); 0 = Doesn't Exist / 1 = Exists [Author guinness]
    RegRead($sKeyName, $sValueName)
    Return Number(@error = 0)
EndFunc   ;==>_IsRegistryExist

Which gives me the key, now all i need to do is find a way to make it cycle through multiple program keys cycled through the registry key it finds

#include <Array.au3>

$sRegKey = '{26A24AE4-039D-4CA4-87B4-2F83217055FF}|DAEMON Tools Lite|{FF988B97-F2DB-11DA-8EB3-D6D1489BBD25}'
Global $aRegKeys = StringSplit($sRegKey, "|")
_ArrayDisplay( $aRegKeys)

;~ $StringFirst = "QuietUninstallString"
;~ $StringSecond = "UninstallString"

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'
Global $aRegPath = StringSplit($sRegPath, "|")
_ArrayDisplay( $aRegPath)

For $i = 1 To $aRegPath[0]
    Local $i, $l
    If _IsRegistryExist($aRegPath[$i] & $aRegKeys[$l], "QuietUninstallString") = 1 Then
        $UninstallPath = RegRead($aRegPath[$i], "QuietUninstallString")
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    ElseIf _IsRegistryExist($aRegPath[$i] & $aRegKeys[$l], "UninstallString") = 1 Then
        $UninstallPath = RegRead($aRegPath[$i], "UninstallString")
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    Else
        ConsoleWrite('Path Could Not Be Found' & @CRLF)
    EndIf
Next

Func _IsRegistryExist($sKeyName, $sValueName); 0 = Doesn't Exist / 1 = Exists [Author guinness]
    RegRead($sKeyName, $sValueName)
    Return Number(@error = 0)
EndFunc   ;==>_IsRegistryExist

as an example but not sure how to make the 2 arrays work together

Edited by Chimaera

Share this post


Link to post
Share on other sites

Can't you run a loop inside of another? Think that's the basic idea.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

Yeah thats sort of what i was trying here

 

If _IsRegistryExist($aRegPath[$i] & $aRegKeys[$l], "QuietUninstallString") = 1 ThenI

But ill have to play with it some more do i need to have 2 seperate For/Next loops with one inside the other?

Share this post


Link to post
Share on other sites

#17 ·  Posted (edited)

Chimaera,

Here, use this function instead and no need for the = 1 check anymore. Even with the old function _IsRegistryExists(somevar, somevar) Then.. is suffice. As 0 is false and 1 is true. As coders less typing is always a good thing.

Func _IsRegistryExist($sKeyName, $sValueName) ; False = Doesn't Exist / True = Exists [Author guinness]
    RegRead($sKeyName, $sValueName)
    Return @error = 0
EndFunc   ;==>_IsRegistryExist
Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

Thanks guinness ill have a look

 

Can't you run a loop inside of another? Think that's the basic idea.

Been trying to get this working but its not picking any keys up

For $i = 1 To $aRegKeys[0]
    If Not @error Then
        For $i = 1 To $aRegPath[0]
            Local $i, $l
            If _IsRegistryExist($aRegPath[$i] & $aRegKeys[$l], "QuietUninstallString") = 1 Then
                $UninstallPath = RegRead($aRegPath[$i], "QuietUninstallString")
                ConsoleWrite($UninstallPath & @CRLF)
                If @error = 0 Then ContinueLoop
            ElseIf _IsRegistryExist($aRegPath[$i] & $aRegKeys[$l], "UninstallString") = 1 Then
                $UninstallPath = RegRead($aRegPath[$i], "UninstallString")
                ConsoleWrite($UninstallPath & @CRLF)
                If @error = 0 Then ContinueLoop
            Else
                ConsoleWrite('Path Could Not Be Found' & @CRLF)
            EndIf
        Next
    EndIf
Next

Am i doing the loops correctly?, i had a look on the forum but couldnt find any 2 loop examples which of the arrays should i include on the first one the registry keys?

And do i need to find a way to verify something to add the next array to it?

and how do i cycle the names around the keys each time?

Share this post


Link to post
Share on other sites

Not on desktop right now, bet when i get to it i'll look into that, and see what i can do.

Noticed something in:

For $i = 1 To $aRegKeys[0]
    If Not @error Then
        For $i = 1 To $aRegPath[0]

You have the same var $i for both loops, wouldn't that mess things up?

Never tried to do that so im not sure.

and why do you have this?

Local $i, $l

$l is never set/defined to a value, it seems.


Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

This works for me, had to add audacity because i didn't have the other applications:

#include <Array.au3>

$sRegKey = '{26A24AE4-039D-4CA4-87B4-2F83217055FF}|DAEMON Tools Lite|{FF988B97-F2DB-11DA-8EB3-D6D1489BBD25}|Audacity_is1'
Global $aRegKeys = StringSplit($sRegKey, "|")
_ArrayDisplay( $aRegKeys)

;~ $StringFirst = "QuietUninstallString"
;~ $StringSecond = "UninstallString"

$sRegPath ='HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\|HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\|HKCU64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\'
Global $aRegPath = StringSplit($sRegPath, "|")
_ArrayDisplay( $aRegPath)

For $i = 1 To $aRegPath[0]
    For $u = 1 To $aRegKeys[0]
    If _IsRegistryExist($aRegPath[$i] & $aRegKeys[$u], "QuietUninstallString") = 1 Then
        ConsoleWrite('Found QuietUninstallString at: '&$aRegPath[$i] & $aRegKeys[$u] &@CRLF)
        $UninstallPath = RegRead($aRegPath[$i] & $aRegKeys[$u], "QuietUninstallString")
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    ElseIf _IsRegistryExist($aRegPath[$i] & $aRegKeys[$u], "UninstallString") = 1 Then
        ConsoleWrite('Found UninstallString at: '&$aRegPath[$i] & $aRegKeys[$u] &@CRLF)
        $UninstallPath = RegRead($aRegPath[$i] & $aRegKeys[$u], "UninstallString")
        ConsoleWrite($UninstallPath & @CRLF)
        If @error = 0 Then ContinueLoop
    Else
        ConsoleWrite('Path Could Not Be Found' & @CRLF)
    EndIf
    Next
Next

Func _IsRegistryExist($sKeyName, $sValueName); 0 = Doesn't Exist / 1 = Exists [Author guinness]
    RegRead($sKeyName, $sValueName)
    Return Number(@error = 0)
EndFunc   ;==>_IsRegistryExist

EDIT: removed 1 consolewrite used for debug

Edited by careca

Spoiler

Paster - Main function is to paste text, but has more functions.

OpenW - Open With... alternative, Open any file with any application, set it's icon, set application as default.

Renamer - Rename files and folders, remove portions of text from the filename etc.

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Firefox Profile Backup - Backup/restore previously saved profile.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

 

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