DaLiMan Posted May 5, 2004 Share Posted May 5, 2004 (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 May 5, 2004 by DaLiMan Link to comment Share on other sites More sharing options...
SlimShady Posted May 5, 2004 Share Posted May 5, 2004 @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. Link to comment Share on other sites More sharing options...
Administrators Jon Posted May 5, 2004 Administrators Share Posted May 5, 2004 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 Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/ Link to comment Share on other sites More sharing options...
DaLiMan Posted May 5, 2004 Author Share Posted May 5, 2004 @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 EndIfStupid 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. Well it works now and that's what counts! Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now