RegistryRead

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

Locked
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

RegistryRead

Post 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
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: RegistryRead

Post by Neosoft Support »

NeoSoft Support
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Post by Dudus »

Thank you,

but this link was not work. Any other link?

Thank you
D
User avatar
Cipolla
Posts: 166
Joined: Fri Apr 01, 2005 1:45 am
Location: Germany
Contact:

Re: RegistryRead

Post 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
Greetings from Germany
Klaus
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Post by Dudus »

Thank you! I'm beginner in Neobook i made this VBscript but how to execute it?
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: RegistryRead

Post 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
COSTA RICA
PURA VIDA
User avatar
Dudus
Posts: 120
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Post by Dudus »

Thanks Virger,

this is what I need :)

Thanks buddy!
D
Locked