norax Posted September 15, 2010 Share Posted September 15, 2010 so im making a registry editor tool and im having problems with regdelete i currently have this code and it returns error 0 which is (Returns 0 if the key/value does not exist.) however the keyname and valuename were copied directly from regedit.exe so could anyone enlighten me as to whats causing autoit to think the key doesnt exist RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath") MsgBox(0,"z",@error) Link to comment Share on other sites More sharing options...
Achilles Posted September 15, 2010 Share Posted September 15, 2010 This may be a dumb question, but did you check to see if the registry entry was deleted? I'm not sure about this, but if @error is 0 (which is what you're displaying) it might mean that there was no error. Here's from the helpfile:Success: Returns 1. Special: Returns 0 if the key/value does not exist. Failure: Returns 2 if error deleting key/value. @error can be set to following values : 1 if unable to open requested key 2 if unable to open requested main key 3 if unable to remote connect to the registry -1 if unable to delete requested value -2 if unable to delete requested key/value My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
norax Posted September 15, 2010 Author Share Posted September 15, 2010 (edited) the key still exists in the registry and when i combine the valuename with the key name it returns error 1 and nothing is deleted .... after some reading i decided maybe i was wrong about the definition of keyname and valuename but my origional code corrisponds with the registry key exactly as it should. so im not sure where i went wrong =\ Edited September 15, 2010 by norax Link to comment Share on other sites More sharing options...
Varian Posted September 15, 2010 Share Posted September 15, 2010 (edited) The @error value will remain 0 unless there is a failure. You should also check the result of the function. This will show you mo' betta$Result = RegDelete("HKLM\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath") Switch @error Case 0 $String = '@error = ' & @error & ' [All went Well]' Case 1 $String = '@error = ' & @error & ' [unable to open requested key]' Case 2 $String = '@error = ' & @error & ' [unable to open requested main key]' Case 3 $String = '@error = ' & @error & ' [unable to remote connect to the registry]' Case -1 $String = '@error = ' & @error & ' [unable to delete requested value]' Case -2 $String = '@error = ' & @error & ' [unable to delete requested key/value]' EndSwitch MsgBox(32, 'Results', 'Result = ' & $Result & @LF & '1 means Success, 0 means failure' & @LF & $String) EDIT: Included @error descriptions Edited September 15, 2010 by Varian Link to comment Share on other sites More sharing options...
MHz Posted September 15, 2010 Share Posted September 15, 2010 ...RegDelete("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Active Setup\Installed Components\{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}", "StubPath")MsgBox(0,"z",@error)You seem to keep mentioning a registry key when your syntax is trying to delete a registry value "StubPath" in the registry key "{61R7YWP0-UVPW-6R47-7RX0-DBL2VG6TX4UP}". If you want to delete a registry key then you omit the registry value parameter of the RegDelete function call. The script may need to be run as admin to modify HKLM so do ensure that is not an issue. 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