Page 1 of 1

RegistryRead

PostPosted: Wed Dec 28, 2016 12:53 pm
by Dudus
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

Re: RegistryRead

PostPosted: Wed Dec 28, 2016 7:26 pm
by Neosoft Support

Re: RegistryRead

PostPosted: Thu Dec 29, 2016 2:46 am
by Dudus
Thank you,

but this link was not work. Any other link?

Thank you
D

Re: RegistryRead

PostPosted: Thu Dec 29, 2016 4:05 am
by Cipolla
The link is ok for me. Here is the function from Michael Weiner:

Code: Select all
{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

Re: RegistryRead

PostPosted: Thu Dec 29, 2016 4:39 am
by Dudus
Thank you! I'm beginner in Neobook i made this VBscript but how to execute it?

Re: RegistryRead

PostPosted: Thu Dec 29, 2016 7:37 am
by virger
If you try this.
Put the code in Button or ...
Code: Select all
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

Re: RegistryRead

PostPosted: Fri Dec 30, 2016 5:55 am
by Dudus
Thanks Virger,

this is what I need :)

Thanks buddy!
D