Cleanup gui and some unused shit
This commit is contained in:
122
Echo.ahk2
122
Echo.ahk2
@@ -13,14 +13,13 @@ ih.Start()
|
|||||||
addNext := 0
|
addNext := 0
|
||||||
removeNext := 0
|
removeNext := 0
|
||||||
enabledWindows := Map()
|
enabledWindows := Map()
|
||||||
keyLog := Map()
|
|
||||||
whitelistedKeys := Map()
|
whitelistedKeys := Map()
|
||||||
paused := 0
|
paused := 0
|
||||||
|
|
||||||
SetTimer(ResetHook, -60000)
|
SetTimer(ResetHook, -60000)
|
||||||
|
|
||||||
OnKeyDown(InputHook, VK, SC) {
|
OnKeyDown(InputHook, VK, SC) {
|
||||||
global paused, addNext, removeNext, enabledWindows, keyLog, whitelistedKeys
|
global paused, addNext, removeNext, enabledWindows, whitelistedKeys
|
||||||
if (paused) {
|
if (paused) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -56,9 +55,6 @@ OnKeyDown(InputHook, VK, SC) {
|
|||||||
ControlSend("{" . key . " down}",, "ahk_id " . hwnd)
|
ControlSend("{" . key . " down}",, "ahk_id " . hwnd)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!keyLog.Has(key)) {
|
|
||||||
keyLog.Set(key, SC)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
OnKeyUp(InputHook, VK, SC) {
|
OnKeyUp(InputHook, VK, SC) {
|
||||||
@@ -91,96 +87,6 @@ WinGetAll() {
|
|||||||
return [PIDs, winTitles]
|
return [PIDs, winTitles]
|
||||||
}
|
}
|
||||||
|
|
||||||
AllWindowsToString() {
|
|
||||||
allWindows := WinGetAll()
|
|
||||||
output := ""
|
|
||||||
for k, v in allWindows[1] {
|
|
||||||
output .= allWindows[1][k] . ", " . allWindows[2][k] . "|"
|
|
||||||
}
|
|
||||||
return SubStr(output, 1, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
Find(arr, val) {
|
|
||||||
for k, v in arr {
|
|
||||||
if (v = val) {
|
|
||||||
return k
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
EnableWindows(istring) {
|
|
||||||
enabledWindows[1].Clear()
|
|
||||||
enabledWindows[2].Clear()
|
|
||||||
if (!InStr(istring, "|")) {
|
|
||||||
ostring := StrSplit(istring, ", ")
|
|
||||||
if (Find(enabledWindows[1], ostring[1]) = 0) {
|
|
||||||
enabledWindows[1].Push(ostring[1])
|
|
||||||
enabledWindows[2].Push(ostring[2])
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ostring := StrSplit(istring, "|")
|
|
||||||
for v in ostring {
|
|
||||||
ostring2 := StrSplit(v, ", ")
|
|
||||||
if (Find(enabledWindows[1], ostring2[1]) = 0) {
|
|
||||||
enabledWindows[1].Push(ostring2[1])
|
|
||||||
enabledWindows[2].Push(ostring2[2])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GuiSelectActiveWindows(allWindows) {
|
|
||||||
output := []
|
|
||||||
for k, v in allWindows[1] {
|
|
||||||
if (Find(enabledWindows[1], v) != 0) {
|
|
||||||
output.Push(k)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return output
|
|
||||||
}
|
|
||||||
|
|
||||||
MakeUI() {
|
|
||||||
Gui := Gui()
|
|
||||||
Gui.Destroy()
|
|
||||||
string := AllWindowsToString()
|
|
||||||
Gui.Add("ListBox", "Multi w800 h600 vWindowListGUI", string)
|
|
||||||
Gui.Add("Button", "Default", "OK")
|
|
||||||
Gui.Show()
|
|
||||||
selections := GuiSelectActiveWindows(WinGetAll())
|
|
||||||
for k in selections {
|
|
||||||
Gui.Window.ListBox("WindowListGUI").Selected(k, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
KeyLogToString() {
|
|
||||||
output := ""
|
|
||||||
for key in keyLog {
|
|
||||||
output .= key . "|"
|
|
||||||
}
|
|
||||||
return SubStr(output, 1, -1)
|
|
||||||
}
|
|
||||||
|
|
||||||
WhitelistButtonUI() {
|
|
||||||
Gui := Gui()
|
|
||||||
Gui.Destroy()
|
|
||||||
string := KeyLogToString()
|
|
||||||
Gui.Add("ListBox", "Multi w800 h600 vKeyLogUI", string)
|
|
||||||
Gui.Add("Button", "Default", "Save")
|
|
||||||
Gui.Show()
|
|
||||||
selections := GuiSelectActiveWindows(WinGetAll())
|
|
||||||
for k in selections {
|
|
||||||
Gui.Window.ListBox("KeyLogUI").Selected(k, true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
WhitelistKeys(string) {
|
|
||||||
whitelistKeys := Map()
|
|
||||||
for key in StrSplit(string, "|") {
|
|
||||||
whitelistKeys.Set(key, 1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ResetHook() {
|
ResetHook() {
|
||||||
global ih
|
global ih
|
||||||
ih.Stop()
|
ih.Stop()
|
||||||
@@ -208,13 +114,13 @@ TogglePause() {
|
|||||||
|
|
||||||
F5:: {
|
F5:: {
|
||||||
global ih
|
global ih
|
||||||
|
ih.Stop()
|
||||||
|
ih := InputHook("B")
|
||||||
|
ih.KeyOpt("{All}", "NV")
|
||||||
|
ih.OnKeyDown := OnKeyDown
|
||||||
|
ih.OnKeyUp := OnKeyUp
|
||||||
|
ih.Start()
|
||||||
Reload
|
Reload
|
||||||
; ih.Stop()
|
|
||||||
; ih := InputHook("B")
|
|
||||||
; ih.KeyOpt("{All}", "NV")
|
|
||||||
; ih.OnKeyDown := OnKeyDown
|
|
||||||
; ih.OnKeyUp := OnKeyUp
|
|
||||||
; ih.Start()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
F3:: {
|
F3:: {
|
||||||
@@ -265,16 +171,4 @@ F4:: {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
F6:: TogglePause()
|
F6:: TogglePause()
|
||||||
|
|
||||||
ButtonSave() {
|
|
||||||
Gui := Gui()
|
|
||||||
Gui.Submit()
|
|
||||||
WhitelistKeys(Gui.Control("KeyLogUI").Value)
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonOK() {
|
|
||||||
Gui := Gui()
|
|
||||||
Gui.Submit()
|
|
||||||
EnableWindows(Gui.Control("WindowListGUI").Value)
|
|
||||||
}
|
|
Reference in New Issue
Block a user