registry

displays the registry, helpfull, if regedit is disabled on a pc
You can run the script with the test#_script

run/copy the script → de.autohotkey.com/forum/topic8430.html


SetBatchLines, -1
SetControlDelay, -1
Var := "\Sub1″
TreeViewWidth := 563
ListViewWidth := A_ScreenWidth -- TreeViewWidth -- 30

; Generated using SmartGUI Creator 4.0
Menu, MyMenu, Add, Neuer Schlüssel, New
Menu, MyMenu, Add, Löschen, Delete

Menu, NewSub, Add, REG_SZ, REG_SZ
Menu, NewSub, Add, REG_EXPAND_SZ, REG_EXPAND_SZ
Menu, NewSub, Add, REG_MULTI_SZ, REG_MULTI_SZ
Menu, NewSub, Add, REG_DWORD, REG_DWORD
Menu, NewSub, Add, REG_BINARY, REG_BINARY

Menu, 2: MyMenu, Add, Neu, :NewSub
Menu, 2: MyMenu, Add, Ändern, Change
Menu, 2: MyMenu, Add, Löschen, DeleteKey

Gui +Resize
Gui, Add, TreeView, x0 y7 w%TreeViewWidth% h300 gTreeView vTreeView Disabled +AltSubmit,
Gui, Add, ListView, x566 y7 w%ListViewWidth% h510 vListView +AltSubmit, Name|Typ|Wert
Gui, Add, StatusBar
Gui, Show, w907 h642, AHK Regedit
LV_ModifyCol( 1, 120)
LV_ModifyCol( 2, 120)
SB_SetText("Loading the Registry...", 1)
HKEY_CLASSES_ROOT("",TV_Add("HKEY_CLASSES_ROOT", 0))
HKEY_CURRENT_USER("",TV_Add("HKEY_CURRENT_USER", 0))
HKEY_LOCAL_MACHINE("",TV_Add("HKEY_LOCAL_MACHINE", 0))
HKEY_USERS("",TV_Add("HKEY_USERS", 0))
HKEY_CURRENT_CONFIG("",TV_Add("HKEY_CURRENT_CONFIG", 0))
GuiControl, -Disabled, TreeView

SB_SetText("Finished", 1)
Return

F5::
GuiClose:
ExitApp
New:
InputBox, NeuerS, Neuer Schlüssel, Schlüssel Name, , 200, 120
if ErrorLevel
return
if NeuerS =
return
StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
if HKEY1 =
{
RegWrite, REG_SZ, %PathReg%, %NeuerS%, ,
if ErrorLevel
{
MsgBox, 16, Error, Error
return
}
}
else
{
RegWrite, REG_SZ, %HKEY1%, %PathReg%\%NeuerS%, ,
if ErrorLevel
{
MsgBox, 16, Error, Error
return
}
}
TV_Add(NeuerS, TV_GetSelection())
;~ MsgBox, RegWrite, REG_SZ, %HKEY1%, %PathReg%\%NeuerS%
Goto, TreeView

REG_SZ:
TypeCreat = REG_SZ
Goto, CreatNewKey
REG_EXPAND_SZ:
TypeCreat = REG_EXPAND_SZ
Goto, CreatNewKey
REG_MULTI_SZ:
TypeCreat = REG_MULTI_SZ
Goto, CreatNewKey
REG_DWORD:
TypeCreat = REG_DWORD
Goto, CreatNewKey
REG_BINARY:
TypeCreat = REG_BINARY
Goto, CreatNewKey
return

CreatNewKey:
if HKEY1 =
return
InputBox, NeuerKey, Neuer Key, Key Name, , 200, 120
if ErrorLevel
return
if NeuerS =
return
InputBox, NeuerWert, Neuer Wert, Wert `n%NeuerKey% =, , 200, 140
if ErrorLevel
return

StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
if HKEY1 =
return
RegWrite, %TypeCreat%, %HKEY1%, %PathReg%, %NeuerKey%, %NeuerWert%

Goto, TreeView

DeleteKey:
LV_GetText( LVName, LV_GetNext(0, "Focused"), 1)

StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
if LVName = Name
{
return
}
MsgBox, 292, %AddSubTVPath%%Select%, Möchten Sie den Wert "%LVName%"wirklich löschen?
if HKEY1 =
{
MsgBox, 16, Error, Error
return
}
if LVName =
{
MsgBox, 16, Error, Error
return
}

IfMsgBox, Yes
{
RegDelete, %HKEY1%, %PathReg%, %LVName%
if ErrorLevel
MsgBox, 16, Error, Errorlevel
}
Goto, TreeView

Change:
LV_GetText( LVName, LV_GetNext(0, "Focused"), 1)
LV_GetText( LVTYP, LV_GetNext(0, "Focused"), 2)
LV_GetText( LVWert, LV_GetNext(0, "Focused"), 3)
if LVName = Name
return
StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
InputBox, ValueKey, %AddSubTVPath%, %LVName% =, , 200, 120
if ErrorLevel
return

RegWrite, %LVTYP%, %HKEY1%, %PathReg%, %LVName%, %ValueKey%
;~ MsgBox, % LVName " . " LVWert

Goto, TreeView

Delete:
MsgBox, 308, Achtung!, Möchten Sie den Schlüssel "%Select%" und dessen Unterschlüssel wirklich löschen?

IfMsgBox, Yes
{
StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
if HKEY1 =
{
MsgBox, 16, Error, Error: Not allowed!, 3
return
}
;~ MsgBox, RegDelete, %HKEY1%, %PathReg%
RegDelete, %HKEY1%, %PathReg%
if ErrorLevel
{
MsgBox, 16, Error, Error
return
}
else
{
TV_Delete(TV_GetSelection())
}
}
return

GuiContextMenu:
;~ Gosub, TreeView
TV_GetText(Select, TV_GetSelection())
if A_GuiControl = TreeView
{
Menu, MyMenu, Show

}
if A_GuiControl = ListView
{
Menu, 2: MyMenu, Show

}

return

TreeView:
LV_Delete()
;~ TV_GetText(OutputVar, TV_GetSelection())
TV_SelectSub := TV_GetSelection()
AddSubTVPath =

Loop
{
TV_SelectSub := TV_GetParent(TV_SelectSub)
if TV_SelectSub = 0
break
TV_GetText(TVGettextSub, TV_SelectSub)
AddSubTVPath := TVGettextSub "\" AddSubTVPath
}
TV_GetText(Select, TV_GetSelection())
SB_SetText(AddSubTVPath . Select, 1)
SB_Text := AddSubTVPath Select
StringSplit, HKEY, AddSubTVPath, \
PathReg := AddSubTVPath Select
StringReplace, PathReg, PathReg, %HKEY1%\
if HKEY1 =
return
Loop, %HKEY1%, %PathReg%, 0, 0
{
RegRead, Value, %HKEY1%, %PathReg%, %A_LoopRegName%
LV_Add("", A_LoopRegName, A_LoopRegType, Value )
}
return

GuiSize: ; Expand/shrink the ListView and TreeView in response to user's resizing of window.
if A_EventInfo = 1 ; The window has been minimized. No action needed.
return
; Otherwise, the window has been resized or maximized. Resize the controls to match.
GuiControl, Move, TreeView, % "H" . (A_GuiHeight -- 30) ; -30 for StatusBar and margins.
GuiControl, Move, ListView, % "H" . (A_GuiHeight -- 30) . " W" . (A_GuiWidth -- TreeViewWidth -- 3)
return

;====================================================================================
HKEY_CLASSES_ROOT(Folder, ParentItemID=0)
{
Loop, HKEY_CLASSES_ROOT, %Folder%, 2, 0
{

if Folder =
{
HKEY_CLASSES_ROOT(A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))
continue
}

HKEY_CLASSES_ROOT(Folder . "\" . A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))

}
}

HKEY_CURRENT_USER(Folder, ParentItemID=0)
{
Loop, HKEY_CURRENT_USER, %Folder%, 2, 0
{

if Folder =
{
HKEY_CURRENT_USER(A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))
continue
}

HKEY_CURRENT_USER(Folder . "\" . A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))

}
}

HKEY_LOCAL_MACHINE(Folder, ParentItemID=0)
{
Loop, HKEY_LOCAL_MACHINE, %Folder%, 2, 0
{

if Folder =
{
HKEY_LOCAL_MACHINE(A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))
continue
}

HKEY_LOCAL_MACHINE(Folder . "\" . A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))

}
}
HKEY_USERS(Folder, ParentItemID=0)
{
Loop, HKEY_USERS, %Folder%, 2, 0
{

if Folder =
{
HKEY_USERS(A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))
continue
}

HKEY_USERS(Folder . "\" . A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))

}
}

HKEY_CURRENT_CONFIG(Folder, ParentItemID=0)
{
Loop, HKEY_CURRENT_CONFIG, %Folder%, 2, 0
{
;
if Folder =
{
HKEY_CURRENT_CONFIG(A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))
continue
}

HKEY_CURRENT_CONFIG(Folder . "\" . A_LoopRegName, TV_Add(A_LoopRegName, ParentItemID, "Sort"))

}
}

Leave a Reply