When I try to use this, I just get an error -2 or 0. I haven't gotten it to run successfully yet. The logic seems correct and the MsgBox I coded in to test the output is correct..... I'm stumped.
[ autoit ]
#include Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Reg Key Delete", 250, 100) $input1 = GUICtrlCreateInput("", 40, 20, 170) $button1 = GUICtrlCreateButton("Delete Reg Keys", 40, 50, 170) GUICtrlSetOnEvent($button1, "DelButton") GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func DelButton() $data = GUICtrlRead($input1) ; just a test ; MsgBox( 0, "test", "\\" & $data & "\HKLM\Software\Microsoft\MSLicensing\Store", 0) RegDelete("\\" & $data & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing\HardwareID") $regdelstore = RegDelete("\\" & $data & "\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing\HardwareID") If $regdelstore = 1 Then MsgBox(0, @ScriptName, "Key deleted succefully.") ElseIf $regdelstore = 0 Then MsgBox(0, @ScriptName, "Key does not exist or " & $data & " was not found.") ElseIf $regdelstore = 2 Then MsgBox(0, @ScriptName, @error & ": Error deleting key.") Else MsgBox(0, @ScriptName, "Script just tried to delete the ""Store"" reg key, but we don't know what happend") EndIf EndFunc Func CLOSEClicked() Exit EndFunc