Source language: Translate to:

RegistryRead

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

RegistryRead

Postby Dudus » Wed Dec 28, 2016 12:53 pm

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
User avatar
Dudus
 
Posts: 97
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Postby Neosoft Support » Wed Dec 28, 2016 7:26 pm

NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Re: RegistryRead

Postby Dudus » Thu Dec 29, 2016 2:46 am

Thank you,

but this link was not work. Any other link?

Thank you
D
User avatar
Dudus
 
Posts: 97
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Postby Cipolla » Thu Dec 29, 2016 4:05 am

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
Cipolla
 
Posts: 166
Joined: Fri Apr 01, 2005 1:45 am
Location: Germany

Re: RegistryRead

Postby Dudus » Thu Dec 29, 2016 4:39 am

Thank you! I'm beginner in Neobook i made this VBscript but how to execute it?
User avatar
Dudus
 
Posts: 97
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest

Re: RegistryRead

Postby virger » Thu Dec 29, 2016 7:37 am

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
virger
 
Posts: 510
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: RegistryRead

Postby Dudus » Fri Dec 30, 2016 5:55 am

Thanks Virger,

this is what I need :)

Thanks buddy!
D
User avatar
Dudus
 
Posts: 97
Joined: Wed Sep 07, 2005 12:15 pm
Location: Hungary, Budapest


Return to NeoBook Action Commands

Who is online

Users browsing this forum: Bing [Bot] and 1 guest