Well in my best teach a man to fish mode, it would be something like (but you'll have to finish yourself)...

Code:

If ReadValue("HKLM\SomeSubKey","SomeValue")
If DelKey("HKLM\SomeSubKey")
"An error occured: " + @SERROR ?
EndIf
EndIf