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