Added whitelist functionality
This commit is contained in:
45
Echo.ahk
45
Echo.ahk
@@ -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)
|
||||
|
@@ -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
|
Reference in New Issue
Block a user