Jump to content

_RegExist(), _AddKey(), _DeleteKey() and _UpdateKey()


Go to solution Solved by ioa747,

Recommended Posts

and if you would like to reuse them in your script they should have this form (as function)

_DoesRegKeyExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5")

_DoesRegValueExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir")


; -----------------------------------------------
Func _DoesRegKeyExist($sKeyname)
    Local $sValuename = ""
    RegRead($sKeyname, $sValuename)
    If @error = 1 Then
        SplashTextOn("NOTICE!!", "The registry key " & $sKeyname & " does not exist!", 800, 50, -1, -1)
    Else
        SplashTextOn("NOTICE!!", "The registry key " & $sKeyname & " does exist!", 800, 50, -1, -1)
    EndIf
    Sleep(3000)
    SplashOff()
EndFunc   ;==>_DoesRegKeyExist
; -----------------------------------------------
Func _DoesRegValueExist($sKeyname, $sValuename)
    RegRead($sKeyname, $sValuename)
    If @error = 0 Then
        SplashTextOn("NOTICE!!", "The registry key" & $sKeyname & $sValuename & " exists!", 850, 50, -1, -1)
    Else
        SplashTextOn("NOTICE!!", "The registry key" & $sKeyname  & $sValuename & "...does not exist!", 850, 50, -1, -1)
    EndIf
    Sleep(3000)
    SplashOff()
EndFunc   ;==>_DoesRegValueExist
; -----------------------------------------------

 

I know that I know nothing

Link to comment
Share on other sites

ioa747,

Like "water" had stated previously, though not a direct quote, "K.I.S.S."... which may be interpreted as either, "Keep It Simple, Stupid!" ...or... "Keep It Stupidly Simple!"

As to your two examples,

; Passes a single parameter to _DoesRegKeyExist
_DoesRegKeyExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5")
; -----------------------------------------------
Func _DoesRegKeyExist($sKeyname)
; Code
EndFunc   ;==>_DoesRegKeyExist
; -----------------------------------------------

; Passes two parameters to _DoesRegValueExist
_DoesRegValueExist("HKEY_LOCAL_MACHINE\Software\Native Instruments\Guitar Rig 5", "InstallVSTDir")
Func _DoesRegValueExist($sKeyname, $sValuename)
; Code
EndFunc   ;==>_DoesRegValueExist
; -----------------------------------------------

"Wow!", "Wow!..."Wow!" ...and.. "Wow!"..."Wow!..."Wow!"

Thanks so very much, ioa747. Appreciated!

image.png

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