diff --git a/Echo.ahk b/Echo.ahk index e844c31..2f1a7a5 100644 --- a/Echo.ahk +++ b/Echo.ahk @@ -15,10 +15,18 @@ 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)) - for k, v in enabledWindows[1] { - ControlSend,, {%key% down}, ahk_pid %v% + 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) diff --git a/Echo.exe b/Echo.exe new file mode 100644 index 0000000..08f8714 Binary files /dev/null and b/Echo.exe differ diff --git a/README.md b/README.md index e55ee01..80c9fe0 100644 --- a/README.md +++ b/README.md @@ -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 \ No newline at end of file +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 \ No newline at end of file