Sign in to follow this  
Followers 0
DaLiMan

Regread

4 posts in this topic

#1 ·  Posted (edited)

In my code I want to check if a registry value is there or not.

But when I check it, the program never gives an error. (And I know it must, because I manually deleted this entry!)

I've tried it like the code below (with @Error) but also the same code with 1 or -1 or -2 like the failure shows in the HELP file.

What am I doing wrong?

Please help.....

Global $ChkNaam = RegRead("HKEY_CURRENT_USER\SOFTWARE\CQR", "Naam")

If $ChkNaam = @Error Then
    MsgBox(4, "Test", "Error", 30)

Else
    MsgBox(4, "Test", "OK", 30)
    
EndIF
Edited by DaLiMan

Share this post


Link to post
Share on other sites



@Error can be true or false. You can't ask a variable if it's @error.

You have to ask the @error if it's true or false, like here:

If @error Then
ExitLoop
EndIf

This is what I know. I'm not a script expert; I don't know how to ask the variable if it's true.

I tried: If @Error = false and If @Error = true..........

I have no idea..........

Try some things else wait for responses here.

Share this post


Link to post
Share on other sites

Try

Global $ChkNaam = RegRead("HKEY_CURRENT_USER\SOFTWARE\CQR", "Naam")

If @Error <> 0 Then
   MsgBox(4, "Test", "Error", 30)

Else
   MsgBox(4, "Test", "OK", 30)
EndIF

Share this post


Link to post
Share on other sites

@Error can be true or false. You can't ask a variable if it's @error.

You have to ask the @error if it's true or false, like here:

If @error Then
ExitLoop
EndIf
Stupid of me, but i've done that before.....

But I still don't understand how the failure codes work then.....and what you can do with them in your script. :D

Well it works now and that's what counts! :huh2:

Thanks!

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  
Followers 0