Hi,
do you know how to check the registry section exist? Because i can only check the value of an existing section, but how to detect if this section exist?
RegistryRead "HKEY_CURRENT_USER" "username" "[usernamevariable]"
Thank you!
D
Moderator: Neosoft Support
{NeoBook Function}
Version=5.80
Language=VBScript
Comment=regKeyExists|Function for NeoBook for Windows|Version 1.1|By Michael Weiner <mailto:neobook@cogit.net>|23 September 2015|This function determines whether a registry key exists.
Param=[%root]|Text|Registry root (HKCR, HKCU, HKLM, HKUS, or HKCC)
Param=[%key]|Text|Registry key (Example: Software\Microsoft\Windows)
Param=[%exists]|Variable|Registry key exists (True or False)
{End}
Const HKCR = &H80000000 'HKEY_CLASSES_ROOT
Const HKCU = &H80000001 'HKEY_CURRENT_USER
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Const HKUS = &H80000003 'HKEY_USERS
Const HKCC = &H80000005 'HKEY_CURRENT_CONFIG
Dim oReg: Set oReg = GetObject("winmgmts:!root/default:StdRegProv")
If oReg.EnumKey([%root], "[%key]", arrSubKeys) = 0 Then
publication.nbSetVar "[%exists]", True
Else
publication.nbSetVar "[%exists]", False
End If
RegistryRead "HKEY_CURRENT_USER" "username" "[usernamevariable]"
if "[usernamevariable]" "=" ""
alertbox "REGISTRY USER" "NOT' USER EXISTS"
setvar "[theuser]" "Virger"
RegistryWrite "HKEY_CURRENT_USER" "username" "[theuser]"
else
alertbox "User Registry Name" "[usernamevariable]"
endif
Return to NeoBook Action Commands
Users browsing this forum: No registered users and 0 guests