Jump to content
Sign in to follow this  
cpremo

Read Registry - Entry not there

Recommended Posts

cpremo

I'm trying to read a registry value and make a dicision based on that. However, I can't seem to get it to work if the registry entry is not there. This is what I have:

************************************

If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") = 0 Then

ElseIf RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") <> 0 or RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") =1 Then

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only","Reg_DWORD","0")

EndIf

**********************************

I've also tried this:

**********************************

If RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") = 0 Then

ElseIf RegEnumVal("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") <> 0 then

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only","Reg_DWORD","0")

ElseIf RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only") =1 Then

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only","Reg_DWORD","0")

EndIf

*********************************

Share this post


Link to post
Share on other sites
weaponx

$result = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only")

If @ERROR Then

...;FAIL

Else

...;OK

EndIf

Share this post


Link to post
Share on other sites
zorphnog

Try this:

Local $iValue
$iValue = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only")
If $iValue = "" Or $iValue <> 0 Then RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Novell\Login","Workstation Only","Reg_DWORD","0")

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.