mr-es335 Posted September 18, 2024 Posted September 18, 2024 (edited) Good day, In responses to this...[Click_Me]...in response to the following three points... Quote 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 I have derived the following...[...based on content from the HelpFile, RegRead() an, RegDelete() and RegWrite()...] expandcollapse popup; ----------------------------------------------- #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") _AddKey() _DeleteKey() _UpdateKey() ; ----------------------------------------------- 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 ; ----------------------------------------------- Func _AddKey() ; HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5 ; "UserContent"="C:\Program Files\Native Instruments\Reflektor\User_Impulses\" ; Source data Local $sKey = "HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent", "REG_SZ", "C:\Program Files\Native Instruments\Reflektor\User_Impulses\") ; ----------------------------------------------- If IsAdmin() Then MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...succesfully added") Else MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...not succesfully added") EndIf ; ----------------------------------------------- ; clean registry ;RegDelete($sKey, "UserContent") EndFunc ;==>_AddKey ; ----------------------------------------------- Func _DeleteKey() ; HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 ; "InstallVSTDir"="C:\Program Files\Native Instruments\VSTPlugins 32 bit" ; Source data Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegDelete = "InstallVSTDir" ; ----------------------------------------------- RegDelete($sKey, $iRegDelete) ; ----------------------------------------------- ; To verify....GOSH!!...I did this one myself!!! If IsAdmin() Then MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...succesfully deleted") Else MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...not succesfully deleted" & @CRLF) EndIf EndFunc ;==>_DeleteKey ; ----------------------------------------------- Func _UpdateKey() ; HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 ; "InstallVST64Dir"="C:\RML\SAC\VST_PlugIns\Ampsim\" Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim\") ; ----------------------------------------------- If IsAdmin() Then MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...succesfully updated") Else MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...not succesfully updated") EndIf ; ----------------------------------------------- ; clean registry ;RegDelete($sKey, "InstallVST64Dir") EndFunc ;==>_UpdateKey ; ----------------------------------------------- I do believe that I beginning "...to get the hang of all of this?!?!" Edited September 18, 2024 by mr-es335 mr-es335 Sentinel Music Studios
ioa747 Posted September 18, 2024 Posted September 18, 2024 expandcollapse popup; ----------------------------------------------- #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") _AddKey() _DeleteKey() _UpdateKey() ; ----------------------------------------------- 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 ; ----------------------------------------------- Func _AddKey() ; HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5 ; "UserContent"="C:\Program Files\Native Instruments\Reflektor\User_Impulses\" ; Source data Local $sKey = "HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent", "REG_SZ", "C:\Program Files\Native Instruments\Reflektor\User_Impulses\") ; ----------------------------------------------- ;~ If IsAdmin() Then ;~ MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...succesfully added") ;~ Else ;~ MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...not succesfully added") ;~ EndIf Local $sConfirm = RegRead($sKey, "UserContent") If $sConfirm = "C:\Program Files\Native Instruments\Reflektor\User_Impulses\" Then MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...succesfully added") Else MsgBox($MB_TOPMOST, "RegWrite", $sKey & "...not succesfully added") EndIf ; ----------------------------------------------- ; clean registry ;RegDelete($sKey, "UserContent") EndFunc ;==>_AddKey ; ----------------------------------------------- Func _DeleteKey() ; HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 ; "InstallVSTDir"="C:\Program Files\Native Instruments\VSTPlugins 32 bit" ; Source data Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegDelete = "InstallVSTDir" ; ----------------------------------------------- RegDelete($sKey, $iRegDelete) ; ----------------------------------------------- ; To verify....GOSH!!...I did this one myself!!! ;~ If IsAdmin() Then ;~ MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...succesfully deleted") ;~ Else ;~ MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...not succesfully deleted" & @CRLF) ;~ EndIf $sConfirm = RegRead($sKey, $iRegDelete) If @error = 0 Then MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...not succesfully deleted" & @CRLF) Else MsgBox($MB_TOPMOST, "RegWrite", $iRegDelete & "...succesfully deleted") EndIf EndFunc ;==>_DeleteKey ; ----------------------------------------------- Func _UpdateKey() ; HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 ; "InstallVST64Dir"="C:\RML\SAC\VST_PlugIns\Ampsim\" Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim\") ; ----------------------------------------------- ;~ If IsAdmin() Then ;~ MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...succesfully updated") ;~ Else ;~ MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...not succesfully updated") ;~ EndIf Local $sConfirm = RegRead($sKey, "InstallVST64Dir") If $sConfirm = "C:\RML\SAC\VST_PlugIns\Ampsim\" Then MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...succesfully updated") Else MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...not succesfully updated") EndIf ; ----------------------------------------------- ; clean registry ;RegDelete($sKey, "InstallVST64Dir") EndFunc ;==>_UpdateKey ; ----------------------------------------------- I know that I know nothing
mr-es335 Posted September 18, 2024 Author Posted September 18, 2024 (edited) ioa747, Thanks for the help..appreciated! However, the first key/value does not exist...but is showing as existing... Also, the path "C:\Program Files\Native Instruments\Reflektor\User_Impulses\" does not yet exist. • Can the key/value not be checked itself? Edited September 18, 2024 by mr-es335 mr-es335 Sentinel Music Studios
ioa747 Posted September 18, 2024 Posted September 18, 2024 (edited) we are talking about her first call of _RegExist("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent") ? edit: add ConsoleWrite for confirmation Func _RegExist($sKeyname, $sValuename) ; Check if the registry key exist Local $sValue = RegRead($sKeyname, $sValuename) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $sValue = ' & $sValue & ' >Error code: ' & @error & @CRLF) ;### Debug Console 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 Edited September 18, 2024 by ioa747 I know that I know nothing
mr-es335 Posted September 18, 2024 Author Posted September 18, 2024 (edited) ioa747, As they say, "My bad!" I was looking at the exported reg key and NOT the actual reg key itself. My sincerest apologies here, ioa747!! Please forgive me! How do I check the actual "REG_SZ" value of the _UpdateKey() function? For example: ""HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim\" Edited September 18, 2024 by mr-es335 ioa747 1 mr-es335 Sentinel Music Studios
mr-es335 Posted September 18, 2024 Author Posted September 18, 2024 Hello, Here is what I discovered from [Click_Me] {Altin's post] ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _FindValueData() ; ----------------------------------------------- Func _FindValueData() $i = 2 $var = RegEnumVal("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", $i) ; ----------------------------------------------- MsgBox(4096, $var, RegRead("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", $var)) EndFunc ;==>_FindValueData ; ----------------------------------------------- So far...so good!!! mr-es335 Sentinel Music Studios
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 (edited) Hello, How can I amalgamate..that is, join, the two following scripts so that the value of "$var" in Script 2, is what is being tested|returned? • The output should state: "C:\RML\SAC\VST_PlugIns\Ampsim\...has been successfully updated." ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateKey() _Testing() ; ----------------------------------------------- ; Script 1 Func _UpdateKey() Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim\") ; ----------------------------------------------- If IsAdmin() Then MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...has been successfully updated") Else MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...has not been successfully updated") EndIf EndFunc ;==>_UpdateKey ; ----------------------------------------------- ; Script 2 Func _Testing() $var = RegEnumVal("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", 3) ; ----------------------------------------------- MsgBox(4096, $var, RegRead("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", $var)) EndFunc ;==>_Testing ; ----------------------------------------------- Also, what is the point|reason|purpose or|for "IsAdmin()"? • I am more used to seeing" If @error = 0 Then... Lastly, the output of "MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...has been successfully updated")" is "1"! • Where is that output coming from? Any assistance in this matter would be greatly appreciated! Edited September 19, 2024 by mr-es335 mr-es335 Sentinel Music Studios
Solution ioa747 Posted September 19, 2024 Solution Posted September 19, 2024 (edited) ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateKey() ; ----------------------------------------------- ; Script 1 Func _UpdateKey() ; Update Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" Local $sValueType = "REG_SZ" Local $sValue = "C:\RML\SAC\VST_PlugIns\Ampsim\" Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue) ; ----------------------------------------------- ; Testing - Confirm Local $sConfirm = RegRead($sKey, $sValueName) If $sConfirm = $sValue Then MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...succesfully updated" & @CRLF "Value: " & $sConfirm) Else MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...not succesfully updated" & @CRLF "Value: " & $sConfirm) EndIf EndFunc ;==>_UpdateKey ; ----------------------------------------------- 27 minutes ago, mr-es335 said: Also, what is the point|reason|purpose or|for "IsAdmin()"? https://www.autoitscript.com/autoit3/docs/functions/IsAdmin.htm Edited September 19, 2024 by ioa747 mr-es335 1 I know that I know nothing
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 Hello, I came up with this...[...looks "dirty" however...] ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateVerifyKey() ; ----------------------------------------------- Func _UpdateVerifyKey() Local $sKey = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim\") $var = RegEnumVal("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", 7) ; ----------------------------------------------- If @error = 0 Then MsgBox(4096, $var, RegRead("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", $var) & "...has been sucessfully updated!") EndIf EndFunc ;==>_UpdateVerifyKey ; ----------------------------------------------- mr-es335 Sentinel Music Studios
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 ioa747, Your example is much more elegant... However there were three errors... ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateKey() ; ----------------------------------------------- ; Script 1 Func _UpdateKey() ; Update Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" Local $sValueType = "REG_SZ" Local $sValue = "C:\RML\SAC\VST_PlugIns\Ampsim\" Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue) ; ----------------------------------------------- ; Testing - Confirm Local $sConfirm = RegRead($sKeyName, $sValueName) If $sConfirm = $sValue Then MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...succesfully updated" & @CRLF & "Value: " & $sConfirm) Else MsgBox($MB_TOPMOST, "RegWrite", $iRegWrite & "...not succesfully updated" & @CRLF & "Value: " & $sConfirm) EndIf EndFunc ;==>_UpdateKey ; ----------------------------------------------- You had "Local $sConfirm = RegRead($sKey, $sValueName)"...instead of... "Local $sConfirm = RegRead($sKeyName, $sValueName)" Also, you had, "& @CRLF "Value: " & $sConfirm)" ...instead of... "& @CRLF & "Value: " & $sConfirm)" Lastly, how can a string [C:\RML\SAC\VST_PlugIns\Ampsim\] be displayed instead of a numeral [1]? mr-es335 Sentinel Music Studios
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 Hello, Done... ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateKey() ; ----------------------------------------------- ; Script 1 Func _UpdateKey() ; Update Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" Local $sValueType = "REG_SZ" Local $sValue = "C:\RML\SAC\VST_PlugIns\Ampsim\" Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue) Local $sConfirm = RegRead($sKeyName, $sValueName) ; ----------------------------------------------- ; Testing - Confirm If $sConfirm = $sValue Then MsgBox($MB_TOPMOST, "RegWrite", $sValue & "...succesfully updated" & @CRLF & "Value: " & $sConfirm) Else MsgBox($MB_TOPMOST, "RegWrite", $sValue & "...not succesfully updated" & @CRLF & "Value: " & $sConfirm) EndIf EndFunc ;==>_UpdateKey ; ----------------------------------------------- ioa747....I very, very, very much appreciate your efforts!! Thank you very much... • [Click_Me]...begin at 1:06... mr-es335 Sentinel Music Studios
ioa747 Posted September 19, 2024 Posted September 19, 2024 or.. MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...succesfully updated" & @CRLF & "Value: " & $sConfirm) mr-es335 1 I know that I know nothing
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 ioa747, MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...succesfully updated" & @CRLF & "Value: " & $sConfirm) ...much better...thanks again!!! ioa747 1 mr-es335 Sentinel Music Studios
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 ioa747, A few questions, if you would be so kind... In your above example... ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _UpdateRegKey() ; ----------------------------------------------- ; Script 1 Func _UpdateRegKey() ; Source data Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" Local $sValueType = "REG_SZ" Local $sValue = "C:\RML\SAC\VST_PlugIns\Ampsim\" Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue) Local $sConfirm = RegRead($sKeyName, $sValueName) ; ----------------------------------------------- If $sConfirm = $sValue Then MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...was succesfully updated" & @CRLF & "Value: " & $sConfirm) Else MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...was not succesfully updated" & @CRLF & "Value: " & $sConfirm) EndIf EndFunc ;==>_UpdateRegKey ; ----------------------------------------------- ...is the line, "Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue)" really required, as "$iRegWrite" is not deployed anywhere? • Thus, my first question is, "Could RegWrite($sKeyName, $sValueName, $sValueType, $sValue) not simply be deployed n it's own?" I am attempting to employ your script to the other two scripts that I have for adding and deleting various Registry keys. However, for whatever reason, I am unable to get these scripts to work. • Thus, my second "question is, "Why am I unable to get these scripts to work?" • I swear, that the more I think I know, I tend to discover that I really do NOT knowing anything at all!! I want to add the following to your "_UpdateRegKey" script: For _DeleteRegKey()...to update the following: Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVSTDir" Local $sValueType = "REG_SZ" Local $sValue = "C:\Program Files\Native Instruments\VSTPlugins 32 bit" RegDelete($sKeyName, $sValueName) For _AddRegKey(), to update the following: Local $sKeyName = "HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5" Local $iRegWrite = RegWrite("HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent", "REG_SZ", "C:\Program Files\Native Instruments\Reflektor\User_Impulses\") Any assistance in these matters would be greatly appreciated! mr-es335 Sentinel Music Studios
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 Hello, So, I have been able to successfully update the "_AddRegKey" script! Here is that updated-and-working script: ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _AddRegKey() ; ----------------------------------------------- Func _AddRegKey() Local $sKeyName = "HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "UserContent" Local $sValueType = "REG_SZ" Local $sValue = "C:\Program Files\Native Instruments\Reflektor\User_Impulses\" Local $sConfirm = RegRead($sKeyName, $sValueName) ; ----------------- Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue) ; ----------------------------------------------- If $sConfirm = $sValue Then MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...was succesfully updated" & @CRLF & "Value: " & $sConfirm) Else MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...was not succesfully updated" & @CRLF & "Value: " & $sConfirm) EndIf EndFunc ;==>_AddRegKey ; ----------------------------------------------- However, the "_DeleteRegKey" script is still not working!!! Why?? Here is what I have thus far....[Man! I am "stumped"?!?!?] ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _DeleteRegKey() ; ----------------------------------------------- Func _DeleteRegKey() ; Source data Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVSTDir" Local $sConfirm = RegRead($sKeyName, $sValueName) ; ----------------- Local $iRegDelete = RegDelete($sKeyName, $sValueName) ; ----------------------------------------------- ; Yours "Does NOT Work!" ;If $sConfirm = $sValueName Then ; MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was succesfully updated" & @CRLF & "ValueName: " & $sConfirm) ;Else ; MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was not succesfully updated" & @CRLF & "ValueName: " & $sConfirm) ;EndIf ; ----------------- ; Mine "Works!" ;If @error = 0 Then ;MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was succesfully deleted") ;Else ; MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was not succesfully deleted") ;EndIf EndFunc ;==>_DeleteRegKey ; ----------------------------------------------- mr-es335 Sentinel Music Studios
ioa747 Posted September 19, 2024 Posted September 19, 2024 38 minutes ago, mr-es335 said: ...is the line, "Local $iRegWrite = RegWrite($sKeyName, $sValueName, $sValueType, $sValue)" really required, you don't need it anymore, since we removed it from the msgbox it could be RegWrite($sKeyName, $sValueName, $sValueType, $sValue) I know that I know nothing
ioa747 Posted September 19, 2024 Posted September 19, 2024 (edited) HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5 i thing #RequireAdmin look at if value exist in HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5 not #RequireAdmin Edit: wait, I don't understand what the problem is what doesn't work the deletion? or the confirmation? Edited September 19, 2024 by ioa747 I know that I know nothing
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 ioa747, You stated, "what doesn't work, the deletion; or the confirmation;" The confirmation,...see image... • The named path WAS actually deleted!! mr-es335 Sentinel Music Studios
ioa747 Posted September 19, 2024 Posted September 19, 2024 (edited) ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _DeleteRegKey() ; ----------------------------------------------- Func _DeleteRegKey() ; Source data Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVSTDir" RegDelete($sKeyName, $sValueName) ; ----------------------------------------------- $sConfirm = RegRead($sKeyName, $sValueName) If @error = 0 Then ; If @error = 0, it means he read it, so it wasn't deleted MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...not succesfully deleted" & @CRLF) Else MsgBox($MB_TOPMOST, "RegWrite", $sValueName & "...succesfully deleted") EndIf ;EndIf EndFunc ;==>_DeleteRegKey ; ----------------------------------------------- or ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _DeleteRegKey() ; ----------------------------------------------- Func _DeleteRegKey() ; Source data Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVSTDir" Local $sConfirm = RegDelete($sKeyName, $sValueName) ; ----------------------------------------------- If $sConfirm = 1 Then ; 1 = succesfully deleted MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was succesfully deleted") Else MsgBox($MB_TOPMOST, "RegDelete", $sValueName & "...was not succesfully deleted") EndIf EndFunc ;==>_DeleteRegKey ; ----------------------------------------------- Edited September 19, 2024 by ioa747 I know that I know nothing
mr-es335 Posted September 19, 2024 Author Posted September 19, 2024 ioa747, Okay! I have updated the scripts as follows: ; ----------------------------------------------- #include <MsgBoxConstants.au3> ; ----------------------------------------------- _DeleteRegKey() ; ----------------------------------------------- Func _DeleteRegKey() ; Source data Local $sKeyName = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVSTDir" ; ----------------------------------------------- RegDelete($sKeyName, $sValueName) ; ----------------- If @error = 1 Then ; If @error = 0, it means he read it, so it wasn't deleted ; Output A MsgBox($MB_ICONINFORMATION, "RegRead", $sKeyName & @CRLF & "...was not succesfully deleted" & @CRLF & "ValueName : Exists!") Else ; Output B MsgBox($MB_ICONINFORMATION, "RegRead", $sKeyName & @CRLF & "...was succesfully deleted" & @CRLF & "ValueName : Does not exist!") EndIf EndFunc ;==>_DeleteRegKey ; ----------------------------------------------- As present, if I restore the Reg key and value, and comment-out "RegDelete($sKeyName, $sValueName)" - I receive the following result: See Output A.png Then, if I remove the comment from "RegDelete($sKeyName, $sValueName)" - I still receive the same end result: See Output B.png "Why" • I am beginning to see that I really need to do more work on "If...Then's"... mr-es335 Sentinel Music Studios
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