mr-es335 Posted September 15 Share Posted September 15 Good day, I have the following script: expandcollapse popup; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _UpdateRegValueData2() ; ----------------------------------------------- Func _UpdateRegValueData2() ; Source data Local $_sSrcPath1 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" Local $_sSrcPath2 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" Local $_sSrcPath3 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" Local $_sSrcPath4 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" Local $_sSrcPath5 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" Local $_sSrcPath6 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" Local $_sSrcPath7 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" Local $_sSrcPath8 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" Local $_sSrcPath9 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" Local $_sSrcPath10 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" Local $_sSrcPath11 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" ; ----------------------------------------------- SplashTextOn("NOTICE!!", "Update Reg Value 2 data...", 350, 50, -1, -1) Sleep(1000) ; ----------------------------------------------- RegDelete($_sSrcPath1) RegDelete($_sSrcPath2) RegDelete($_sSrcPath3) RegDelete($_sSrcPath4) RegDelete($_sSrcPath5) RegDelete($_sSrcPath6) RegDelete($_sSrcPath7) RegDelete($_sSrcPath8) RegDelete($_sSrcPath9) RegDelete($_sSrcPath10) RegDelete($_sSrcPath11) ; ----------------------------------------------- SplashTextOn("NOTICE!!", "Update Reg Value 2 data completed...", 350, 50, -1, -1) Sleep(1000) SplashOff() EndFunc ;==>_UpdateRegValueData2 ; ----------------------------------------------- I need to verify if the keys are ...in fact, deleted. I did look at RegRead...but I cannot seem to "get me head around it!!" Any assistance would be greatly appreciated! mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted September 15 Share Posted September 15 ConsoleWrite("_RegExist=" & _RegExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir") & @CRLF) ConsoleWrite("_RegExist=" & _RegExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDirrr") & @CRLF) Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) If @error Then Return False Else Return True EndIf EndFunc ;==>_RegExist I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 15 Author Share Posted September 15 ioa747, Firstly...and as always...thanks for the follow-up...appreciated! Secondly, how would you direct the output to the screen...instead of the console? Thirdly, how does "_RegExist($sKeyname, $sValuename)" obtain the $sKeyname and $sValuename varables|parameters? mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted September 15 Share Posted September 15 (edited) if you are only interested in the keyname #include <MsgBoxConstants.au3> ConsoleWrite("_RegKeyExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion") & @CRLF) ConsoleWrite("_RegKeyExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersionnn") & @CRLF) Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return False EndIf MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "Exist.") Return True EndFunc ;==>_RegKeyExist Edited September 18 by ioa747 correction I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 15 Author Share Posted September 15 ioa747, For the above...it would "appear" that the Console is outputting the correct output, however both MsgBox's are outputting "Not exist!" - when the first [CurrentVersion] does and the second [CurrentVersionnnn] does not. Also, I have 11 items to read! My example: #include <MsgBoxConstants.au3> Opt("MustDeclareVars", 1) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One") & @CRLF) Func _RegKeyExist($sKeyname) ; Check if the Keyname exist RegRead($sKeyname, "") If @error = -1 Then MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return False Else MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return True EndIf EndFunc ;==>_RegExist ...does not work! mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
Solution ioa747 Posted September 15 Solution Share Posted September 15 (edited) I corrected the above here's how it could be expandcollapse popup; ----------------------------------------------- _UpdateRegValueData2() ; ----------------------------------------------- Func _UpdateRegValueData2() Local $_sSrcPath[12] = [11] $_sSrcPath[1] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" $_sSrcPath[2] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" $_sSrcPath[3] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" $_sSrcPath[4] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" $_sSrcPath[5] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" $_sSrcPath[6] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" $_sSrcPath[7] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" $_sSrcPath[8] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" $_sSrcPath[9] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" $_sSrcPath[10] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" $_sSrcPath[11] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" ; ----------------------------------------------- Local $sMessage = "Update Reg Value 2 data..." & @CRLF SplashTextOn("NOTICE!!", $sMessage, 650, 350, -1, -1, 4) Sleep(1000) ; ----------------------------------------------- For $i = 1 to $_sSrcPath[0] RegDelete($_sSrcPath[$i]) $sMessage &= $i & ") " & ( _RegKeyExist($_sSrcPath[$i]) ? "NOT Delete " : "Delete ") & $_sSrcPath[$i] & @CRLF ControlSetText("NOTICE!!", "", "Static1", $sMessage) Sleep(300) Next $sMessage &= "Update Reg Value 2 data completed..." & @CRLF ; ----------------------------------------------- SplashTextOn("NOTICE!!", $sMessage, 650, 350, -1, -1, 4) Sleep(5000) SplashOff() EndFunc ;==>_UpdateRegValueData2 ; ----------------------------------------------- Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") If @error = 1 Then ;MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return False EndIf ;MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "Exist.") Return True EndFunc ;==>_RegKeyExist or you can just trust Reg Delete() without having to confirm with _RegKeyExist() (he's not going to lie to you) expandcollapse popup; ----------------------------------------------- _UpdateRegValueData2() ; ----------------------------------------------- Func _UpdateRegValueData2() Local $_sSrcPath[12] = [11] $_sSrcPath[1] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" $_sSrcPath[2] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" $_sSrcPath[3] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" $_sSrcPath[4] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" $_sSrcPath[5] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" $_sSrcPath[6] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" $_sSrcPath[7] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" $_sSrcPath[8] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" $_sSrcPath[9] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" $_sSrcPath[10] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" $_sSrcPath[11] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" ; ----------------------------------------------- Local $Result Local $sMessage = "Update Reg Value 2 data..." & @CRLF SplashTextOn("NOTICE!!", $sMessage, 650, 350, -1, -1, 4) Sleep(1000) ; ----------------------------------------------- For $i = 1 to $_sSrcPath[0] $Result = RegDelete($_sSrcPath[$i]) Switch $Result Case 0 ;the key/value does not exist $Result = "does not exist " Case 1 ;Success $Result = "Success Delete " Case 2 ;error deleting key/value $Result = "error deleting " EndSwitch $sMessage &= $i & ") " & $Result & $_sSrcPath[$i] & @CRLF ControlSetText("NOTICE!!", "", "Static1", $sMessage) Sleep(300) Next $sMessage &= "Update Reg Value 2 data completed..." & @CRLF ; ----------------------------------------------- SplashTextOn("NOTICE!!", $sMessage, 650, 350, -1, -1, 4) Sleep(5000) SplashOff() EndFunc ;==>_UpdateRegValueData2 ; ----------------------------------------------- Edited September 18 by ioa747 correction I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 15 Author Share Posted September 15 ioa747, Okay!! SO far...so good!! #include <MsgBoxConstants.au3> ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin") & @CRLF) ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") & @CRLF) Func _RegKeyExist($sKeyname) ; Check if the Keyname exist ;ConsoleWrite("" & @CRLF) RegRead($sKeyname, "") If @error = -1 Then MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & " exists.", 1) Return True Else MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "...does not Exist.", 1) Return False EndIf EndFunc ;==>_RegKeyExist How do you remove the "ConsoleWrite" commands? May I ask where the variable "$sKeyname" and "$sValuename" are derived? mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted September 15 Share Posted September 15 (edited) 26 minutes ago, mr-es335 said: How do you remove the "ConsoleWrite" commands? with deletion from ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") & @CRLF) to _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") 26 minutes ago, mr-es335 said: May I ask where the variable "$sKeyname" and "$sValuename" are derived? is Parameters (The parameters are set by you. in the function ) https://www.autoitscript.com/autoit3/docs/keywords/Func.htm from _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") ... ... https://www.autoitscript.com/autoit3/docs/functions/RegRead.htm look above at here's how it could be https://www.autoitscript.com/forum/topic/212277-detemine-if-reg-key-exists/#comment-1536847 Edited September 15 by ioa747 mr-es335 1 I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 15 Author Share Posted September 15 (edited) ioa747, Well ioa747, you have helped me again!! Much "undermeicated!!" Here is the completed script: ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin") _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") ; ----------------------------------------------- Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") If @error = -1 Then MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & " exists.", 1) Return True Else MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "...does not Exist.", 1) Return False EndIf EndFunc ;==>_RegKeyExist ; ----------------------------------------------- If it were possible, ios747, I would give you "arrays"!! Thank you so very much for all of your time....appreciated! PS: my apologies...missed this one https://www.autoitscript.com/forum/topic/212277-detemine-if-reg-key-exists/#comment-1536847 • "WOW!" WOW,WOW!"...and..."WOW, WOW, WOW!!" Thanks! Edited September 16 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted September 15 Share Posted September 15 ;~ this was not much different ;~ from that Local $_sSrcPath1 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" Local $_sSrcPath2 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" Local $_sSrcPath3 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" Local $_sSrcPath4 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" Local $_sSrcPath5 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" Local $_sSrcPath6 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" Local $_sSrcPath7 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" Local $_sSrcPath8 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" Local $_sSrcPath9 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" Local $_sSrcPath10 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" Local $_sSrcPath11 = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" ;~ to this Local $_sSrcPath[12] = [11] $_sSrcPath[1] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" $_sSrcPath[2] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" $_sSrcPath[3] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" $_sSrcPath[4] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" $_sSrcPath[5] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" $_sSrcPath[6] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" $_sSrcPath[7] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" $_sSrcPath[8] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" $_sSrcPath[9] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" $_sSrcPath[10] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" $_sSrcPath[11] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" ;~ simply with arrays, they are more easily managed in a loop I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 18 Author Share Posted September 18 (edited) ioa747, Just to be absolutely sure that I understand things here? First... ; $sKeyname $sValuename ConsoleWrite("_RegExist=" & _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") & @CRLF) ConsoleWrite("_RegExist=" & _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir") & @CRLF) ; Thus... ; $sKeyname = HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5 and HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 ; $sValuename = UserContent and InstallVSTDir ; ...are the parameters that are being sent to Func _RegExist() Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) If @error Then Return False Else Return True EndIf EndFunc ;==>_RegExist5 Second... ; How do you remove the "ConsoleWrite" commands? ; Change: ConsoleWrite("_RegExist=" & _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") & @CRLF) ;To: _RegKeyExist("HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano") ;ConsoleWrite("_RegExist=" & _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") & @CRLF) ;ConsoleWrite("_RegExist=" & _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir") & @CRLF) _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir") Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) If @error Then Return False Else Return True EndIf EndFunc ;==>_RegExist5 ..and third... ; How do I output the datas to the display? ; 1) Update: RegRead($sKeyname, $sValuename) ; 2) Update TO the following: ; If @error = -1 Then ; MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & " exists.") ; Return True ; Else ; MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "...does not Exist.") ; Return False ; EndIf #include <MsgBoxConstants.au3> _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir") Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) If @error = -1 Then MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & " exists.") Return True Else MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & "...does not Exist.") Return False EndIf EndFunc ;==>_RegExist Would these be correct? • I simply want to be absolutely sure that I NOT missing something here! • All three of the above appear to be "working as they should"? Edited September 18 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
mr-es335 Posted September 18 Author Share Posted September 18 (edited) Hello, I had to update [If @error = -1 Then] to [If @error = 0 Then] to obtain the correct output. • I do find it interesting that "0" is not mentioned in the Helpfile!! I simply assumed that "0" meant success?!? #include <MsgBoxConstants.au3> _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir") _RegExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir") Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) If @error = 0 Then MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & $sValuename & @CRLF & " exists.") Return True Else MsgBox($MB_SYSTEMMODAL, "Registry", "The registry key" & @CRLF & $sKeyname & @CRLF & $sValuename & @CRLF & "...does not Exist.") Return False EndIf EndFunc ;==>_RegExist Now, to be able to update those keys?!? • The first needs to be added • The second needs to be deleted • The third needs to be updated Please see this: [Click_Me] Edited September 18 by mr-es335 mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
ioa747 Posted September 18 Share Posted September 18 (edited) expandcollapse popup;~ it depends on the case at first to distinguish ;~ Func _RegExist($sKeyname, $sValuename) ;~ from ;~ Func _RegKeyExist($sKeyname) ;~ @error: ;~ 1 = unable to open requested key ;~ 2 = unable to open requested main key ;~ 3 = unable to remote connect to the registry ;~ -1 = unable to open requested value ;~ -2 = value type not supported #include <MsgBoxConstants.au3> _RegExist("HKEY_CURRENT_USER\SOFTWARE\AutoIt v3\AutoIt", "Include") _RegExist("HKEY_CURRENT_USER\SOFTWARE\AutoIt v3\AutoIt", "") _RegKeyExist("HKEY_CURRENT_USER\SOFTWARE\AutoIt v3\AutoIt") _RegKeyExist("HKEY_CURRENT_USER\SOFTWARE\AutoIt v3\AutoIt33") ;--------------------------------------------------------------------------------------------------------- Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist RegRead($sKeyname, $sValuename) Local $err = @error ConsoleWrite("$err=" & $err & @CRLF) If $err = 0 Then MsgBox($MB_SYSTEMMODAL, "_RegExist", "The registry key" & @CRLF & $sKeyname & @CRLF & $sValuename & @CRLF & " exists.") Return True Else MsgBox($MB_SYSTEMMODAL, "_RegExist", "The registry key" & @CRLF & $sKeyname & @CRLF & $sValuename & @CRLF & "...does not Exist.") Return False EndIf EndFunc ;==>_RegExist ;--------------------------------------------------------------------------------------------------------- Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") Local $err = @error ConsoleWrite("$err=" & $err & @CRLF) If $err = 1 Then MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return False EndIf MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "Exist.") Return True EndFunc ;==>_RegKeyExist ;--------------------------------------------------------------------------------------------------------- Edited September 18 by ioa747 correction I know that I know nothing Link to comment Share on other sites More sharing options...
ioa747 Posted September 18 Share Posted September 18 correction ;--------------------------------------------------------------------------------------------------------- Func _RegKeyExist($sKeyname) RegRead($sKeyname, "") Local $err = @error ConsoleWrite("$err=" & $err & @CRLF) If $err = 1 Then MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "NOT Exist.") Return False EndIf MsgBox($MB_SYSTEMMODAL, "_RegKeyExist", "The registry key" & @CRLF & $sKeyname & @CRLF & "Exist.") Return True EndFunc ;==>_RegKeyExist ;--------------------------------------------------------------------------------------------------------- mr-es335 1 I know that I know nothing Link to comment Share on other sites More sharing options...
mr-es335 Posted September 21 Author Share Posted September 21 ioa747, Can you please explain the following syntax to me please: Local $_sSrcPath[12] = [11] Thanks! mr-es335 Sentinel Music Studios Link to comment Share on other sites More sharing options...
water Posted September 21 Share Posted September 21 This sets the first element of the array to the number of elements in the array. Details can be found here - Section "Arrays". ioa747 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
ioa747 Posted September 21 Share Posted September 21 is the same as this ;~ to this Local $_sSrcPath[12] ; = [11] $_sSrcPath[0] = 11 $_sSrcPath[1] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Micro" $_sSrcPath[2] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\One" $_sSrcPath[3] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-C" $_sSrcPath[4] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-DS" $_sSrcPath[5] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-G" $_sSrcPath[6] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Pro-L" $_sSrcPath[7] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Saturn" $_sSrcPath[8] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Simplon" $_sSrcPath[9] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Timeless" $_sSrcPath[10] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Twin" $_sSrcPath[11] = "HKEY_LOCAL_MACHINE\SOFTWARE\FabFilter\Volcano" I know that I know nothing Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now