Added whitelist functionality

This commit is contained in:
PhatDave
2021-10-27 15:02:10 +02:00
parent 96a7aaf8a6
commit a83674caf5
3 changed files with 54 additions and 3 deletions

View File

@@ -15,11 +15,19 @@ global enabledWindows := Array()
enabledWindows.Push(Array())
enabledWindows.Push(Array())
global keyLog := {}
global whitelistKeys := {}
OnKeyDown(InputHook, VK, SC) {
key := GetKeyName(Format("vk{:x}sc{:x}", VK, SC))
if (whitelistKeys.HasKey(key)) {
for k, v in enabledWindows[1] {
ControlSend,, {%key% down}, ahk_pid %v%
}
}
if (!keyLog.HasKey(key)) {
keyLog[key] := SC,
}
; ControlSend,, v, ahk_pid 16736
; Tooltip, %key%
}
@@ -120,10 +128,47 @@ MakeUI() {
}
}
KeyLogToString() {
output := ""
for k, v in keyLog {
output .= k
output .= "|"
}
StringTrimRight, output, output, 1
return output
}
WhitelistButtonUI() {
Gui, Destroy
string := KeyLogToString()
Gui, Add, ListBox, Multi w500 vKeyLogUI r10, %string%
Gui, Add, Button, Default, Save
Gui, Show
for k, v in GuiSelectActiveWindows(WinGetAll()) {
; See what's wrong with choose, maybe it doesn't like to be called many times though just that is being done on forum guy
GuiControl, Choose, WindowListGUI, v
}
}
WhitelistKeys(string) {
for k, v in StrSplit(string, "|") {
whitelistKeys[v] := true
}
}
F3::
MakeUI()
return
F4::
WhitelistButtonUI()
return
ButtonSave:
Gui, Submit
WhitelistKeys(KeyLogUI)
return
ButtonOK:
Gui, Submit
EnableWindows(WindowListGUI)

BIN
Echo.exe Normal file

Binary file not shown.

View File

@@ -4,4 +4,10 @@ Mainly used (and made) for World of Warcraft but it might have it's other uses
F3 brings up UI which allows the user to select 1 or more applications to echo **all** keyboard events to
In the current state ALL events are echoed, customizability is planned
In the current state ALL events are echoed, ~~customizability is planned~~
### 1.1.x
Keys can now be whitelisted and only whitelisted keys will be echoed
The whitelist menu can be accessed by pressing F4 and only keys pressed since the start of the program will be shown, user can then pick as many as they please to whitelist and only those the user picks will be echoed to other windows