' VBScript clean WriteLog V12 default on-screen window positions from the Windows registry
' Instructions: 
' Use Windows Explorer to double click this file. It will display a message on success or failure.
'
'IMPORTANT: THE NEXT TIME YOU RUN WRITELOG, HOLD DOWN CTRL WHILE YOU OPEN
'ANY EXISTING .WL FILE.
'The window positions are saved in the .wl file and you'll be right back
' where you started if you fail to hold down CTRL.
'
HKEY_CURRENT_USER = 2147483649
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
' Key where the on-screen window positions are stored
Key     = "SOFTWARE\W5XD\writelog_v12\Workspace"

' The settings are two levels deep. Delete deeper level first
oReg.EnumKey HKEY_CURRENT_USER, Key, arrSubKeys
If (IsNull( arrSubKeys ) = false) Then
  For Each subkey In arrSubKeys
    oReg.DeleteKey HKEY_CURRENT_USER, Key & "\" & subkey
  Next
End If

' Delete the Workspace key
Return = oreg.DeleteKey (HKEY_CURRENT_USER, Key)
If (Return = 0) And (Err.Number = 0) Then    
    Wscript.Echo _
        "HKEY_CURRENT_USER\" & _
	Key & _
        " successfully deleted"
Else
    Wscript.Echo "DeleteKey failed."
End If


