mr-es335 Posted Monday at 03:05 PM Posted Monday at 03:05 PM Good day, In the following script: Spoiler #include <Array.au3> #include <ExtMsgBox.au3> Opt("MustDeclareVars", 1) ;~ Opt("MouseCoordMode", 0) ImportRegKeys() Func ImportRegKeys() Local $sMsg = " The following Registry keys will be imported..." Local $sResult Local $aSrcPath[] = [ _ "E:\Backups\App_Install\2_GR5\RegKeys\hkcu_ni.reg", _ "E:\Backups\App_Install\2_GR5\RegKeys\hklm_ni.reg"] ; ----------------------------------------------- _ArrayColInsert($aSrcPath, 1) ; ----------------------------------------------- For $i = 0 To UBound($aSrcPath) - 1 $aSrcPath[$i][1] = RunWait('reg import ' & $aSrcPath[$i][0], "", @SW_HIDE) ? "...No " : "...Yes " ;~ ConsoleWrite($aSrcPath[$i][0] & @CRLF) Next ; ----------------------------------------------- $sResult = _ArrayToString($aSrcPath, "") ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", $sMsg, $sResult, 2) EndFunc ;==>ImportRegKeys ...the output of the paths|results of the data that is being updated are displayed in a dialog box. I have been attempting - rather unsuccessfully, to perform the same function with RegWrite. For example, in the following script: Spoiler #include <Array.au3> #include "ExtMsgBox.au3" Opt("MustDeclareVars", 1) Opt("MouseCoordMode", 0) UpdateRegKeys() Func UpdateRegKeys() Local $sStartMsg = "Update Registry keys in progress... " Local $sEndMsg = "Update Registry keys has completed! " ; ----------------- Local $iRow = 2, $iColumn = 4 ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sStartMsg, 2) ; ----------------------------------------------- Local $Array[$iRow][$iColumn] = [ _ ["HKEY_CURRENT_USER\Software\Native Instruments\Guitar Rig 5", "UserContent", "REG_SZ", "C:\Program Files\Native Instruments\Reflektor\16 User_Impulses\"], _ ["HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVST64Dir", "REG_SZ", "C:\RML\SAC\VST_PlugIns\Ampsim"]] ;~ _ArrayDisplay($Array, "") ; ----------------------------------------------- For $i = 0 To UBound($Array) - 1 ;~ Local $sResult = RegWrite($Array[$i][0], $Array[$i][1], $Array[$i][2], $Array[$i][3]) ConsoleWrite("RegWrite (" & $Array[$i][0] & ", " & $Array[$i][1] & ", " & $Array[$i][2] & ", " & $Array[$i][3] & ")" & @CRLF) Next ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Notice!", $sEndMsg, 2) EndFunc ;==>UpdateRegKeys Though the dialog text [$sStartMsg, and $sEndMsg] are being displayed, what is being updated is NOT being displayed - for example, as with the previous example. What IS being updated however, is being displayed via ConsoleWrite! Thus, can this task be accomplished via RegWrite? As always, any assistance in this matter would be greatly appreciated! mr-es335 Sentinel Music Studios
mr-es335 Posted 17 hours ago Author Posted 17 hours ago Hello, Here is a "workaround"...but not what I am really looking for: Spoiler #include <Array.au3> Opt("MustDeclareVars", 1) ;~ Opt("MouseCoordMode", 0) AdlibRegister("_Closer") Global $sMsg DeleteRegKey() Func DeleteRegKey() ; ----------------- Local $iRow = 1, $iColumn = 2 ; ----------------------------------------------- Local $Array[$iRow][$iColumn] = [ _ ["HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir"]] _ArrayDisplay($Array, $sMsg, Default, 0) ; ----------------------------------------------- For $i = 0 To UBound($Array) - 1 Local $sResult = RegDelete($Array[$i][0], $Array[$i][1]) ;~ ConsoleWrite("RegWrite (" & $Array[$i][0] & ", " & $Array[$i][1] & ")" & @CRLF) Next EndFunc ;==>DeleteRegKey Func _Closer() If WinExists($sMsg) Then Sleep(2000) WinClose($sMsg) AdlibUnRegister("_Closer") EndIf EndFunc ;==>_Closer mr-es335 Sentinel Music Studios
mr-es335 Posted 12 hours ago Author Posted 12 hours ago ...two "other" offerings: Spoiler #include <ExtMsgBox.au3> ConfirmRegValue() Func ConfirmRegValue() Local $sKeyPath = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" Local $sDefaultValue = RegRead($sKeyPath, $sValueName) Local $sMsgA = "The key path is: " & "''" & $sKeyPath & "''" & " " & @CRLF & _ "The value name is: " & "''" & $sValueName & "''" & @CRLF & _ "The default value is: " & "''" & $sDefaultValue & "''" ; --------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(64, " ", " Confirm Default Value!", $sMsgA, 4) EndFunc ;==>ConfirmRegValue Spoiler #include <ExtMsgBox.au3> DoesRegValueExist() Func DoesRegValueExist() ;~ Local $sKeyPath = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" ;~ Local $sValueName = "InstallVSTDir" Local $sKeyPath = "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5" Local $sValueName = "InstallVST64Dir" _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) RegRead($sKeyPath, $sValueName) If @error = 0 Then _ExtMsgBox(64, " ", " Notice!", "The Registry key value: ''" & $sValueName & "''...does exist. ", 2) Else _ExtMsgBox(64, " ", " Notice!", "The Registry key value: ''" & $sValueName & "''...does not exist. ", 2) EndIf EndFunc ;==>DoesRegValueExist I would STILL prefer to employ a "pattern" such as that which follows... Spoiler #include <Array.au3> #include <ExtMsgBox.au3> Opt("MustDeclareVars", 1) ;~ Opt("MouseCoordMode", 0) DoesRegKeyExist() Func DoesRegKeyExist() Local $sMsg = " Does the following Registry key exist?" Local $sResult Local $aSrcPath[] = [ _ "HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5"] ; ----------------------------------------------- _ArrayColInsert($aSrcPath, 1) ; ----------------------------------------------- For $i = 0 To UBound($aSrcPath) - 1 $aSrcPath[$i][1] = RegEnumKey($aSrcPath[$i][0], 1) ? "...Yes " : "...No " Next ; ----------------------------------------------- $sResult = _ArrayToString($aSrcPath, "") ; ----------------------------------------------- _ExtMsgBoxSet(64, 4, Default, Default, 14, "Segoe UI Semibold", 1000) _ExtMsgBox(32, " ", $sMsg, $sResult, 2) EndFunc ;==>DoesRegKeyExist 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