Adam9 Posted May 11, 2005 Share Posted May 11, 2005 For some reason, I can't get @error to return 0 when I do RegRead('RegKey', ''). The key definitely exists, and the documentation/forum says to use '' for (Default). I simply want to check for the existence of a key that contains other keys, for example, CurrentVersion. If I specify a value that exists, @error will return 0 (which is good), but '' always returns -1 even if the key exists. Any ideas on why this won't work for me? Thanks. Link to comment Share on other sites More sharing options...
Adam9 Posted May 11, 2005 Author Share Posted May 11, 2005 Thanks for the quick reply! It works beautifully. Link to comment Share on other sites More sharing options...
Adam9 Posted May 18, 2005 Author Share Posted May 18, 2005 Well, some of the registry keys I'm checking for do not have subkeys. So unfortunately, I can't use RegEnumKey. I've tried the beta AutoIt, current, and 3.1.0, and they always give me an @error of not 0 regardless of whether the key exists or not. $check = RegRead($regkey, "") $regkey being the path to the key. Thanks in advance for any help. Link to comment Share on other sites More sharing options...
jpm Posted May 18, 2005 Share Posted May 18, 2005 I cannot reproduce your problem the following code work as design $regkey="HKCR\.2bp" $check = RegRead($regkey, "") MsgBox(262144,'Debug line ~13','Selection:' & @lf & '$check' & @lf & @lf & 'Return:' & @lf & $check & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX $regkey="HKCR\.2bp1" $check = RegRead($regkey, "") MsgBox(262144,'Debug line ~13','Selection:' & @lf & '$check' & @lf & @lf & 'Return:' & @lf & $check & @lf & @lf & '@Error:' & @lf & @Error & @lf & @lf & '@Extended:' & @lf & @Extended);### Debug MSGBOX Link to comment Share on other sites More sharing options...
Adam9 Posted May 20, 2005 Author Share Posted May 20, 2005 That code also works for me, but the keys you used have default values in them. I just need to check if the key exists because most keys do not have default values. Link to comment Share on other sites More sharing options...
Adam9 Posted May 20, 2005 Author Share Posted May 20, 2005 I'm now having it check the registry using RegEnumVal and RegEnumKey. This combination works great. Thanks for all the help Link to comment Share on other sites More sharing options...
jpm Posted May 20, 2005 Share Posted May 20, 2005 I'm now having it check the registry using RegEnumVal and RegEnumKey. This combination works great. Thanks for all the help <{POST_SNAPBACK}>I recheck you get 2 different @error -1 if the default is not set and 1 if the key is not defined as stated in the doc 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