Can now be paused with F6

This commit is contained in:
PhatDave
2021-10-30 13:09:58 +02:00
parent e4d03b272f
commit 3cf2894854

View File

@@ -24,6 +24,8 @@ enabledWindows.Push(Array())
global keyLog := Array() global keyLog := Array()
global whitelistKeys := Array() global whitelistKeys := Array()
global paused := 0
SetTimer, ResetHook, -60000 SetTimer, ResetHook, -60000
whitelistKeys["q"] := 1 whitelistKeys["q"] := 1
@@ -32,6 +34,7 @@ whitelistKeys[1] := 1
whitelistKeys[2] := 1 whitelistKeys[2] := 1
whitelistKeys[3] := 1 whitelistKeys[3] := 1
whitelistKeys[4] := 1 whitelistKeys[4] := 1
whitelistKeys[5] := 1
whitelistKeys["LShift"] := 1 whitelistKeys["LShift"] := 1
whitelistKeys["LControl"] := 1 whitelistKeys["LControl"] := 1
whitelistKeys["g"] := 1 whitelistKeys["g"] := 1
@@ -42,6 +45,7 @@ whitelistKeys["c"] := 1
whitelistKeys["y"] := 1 whitelistKeys["y"] := 1
OnKeyDown(InputHook, VK, SC) { OnKeyDown(InputHook, VK, SC) {
if (!paused) {
key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC)) key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC))
if (addNext) { if (addNext) {
if (!whitelistKeys.HasKey(Key)) { if (!whitelistKeys.HasKey(Key)) {
@@ -80,6 +84,7 @@ OnKeyDown(InputHook, VK, SC) {
keyLog[key] := SC, keyLog[key] := SC,
} }
} }
}
ShowTooltip(text) { ShowTooltip(text) {
ToolTip, %text% ToolTip, %text%
@@ -91,6 +96,7 @@ RemoveToolTip:
return return
OnKeyUp(InputHook, VK, SC) { OnKeyUp(InputHook, VK, SC) {
if (!paused) {
key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC)) key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC))
if (whitelistKeys.HasKey(key)) { if (whitelistKeys.HasKey(key)) {
for k, v in enabledWindows[1] { for k, v in enabledWindows[1] {
@@ -98,6 +104,7 @@ OnKeyUp(InputHook, VK, SC) {
} }
} }
} }
}
; Not really mine at all ; Not really mine at all
SortArray(Array, Order="A") { SortArray(Array, Order="A") {
@@ -292,6 +299,17 @@ ResetHook:
SetTimer, ResetHook, -30000 SetTimer, ResetHook, -30000
return return
TogglePause() {
if (paused) {
ShowTooltip("Unpaused")
paused := 0
return
}
ShowTooltip("Paused")
paused := 1
return
}
F5:: F5::
ih.Stop() ih.Stop()
@@ -330,6 +348,10 @@ F4::
WhitelistButtonUI() WhitelistButtonUI()
return return
F6::
TogglePause()
return
ButtonSave: ButtonSave:
Gui, Submit Gui, Submit
WhitelistKeys(KeyLogUI) WhitelistKeys(KeyLogUI)