I'm creating a remote for an emulator so I can play on my TV while my wife is on the computer. In order to target the emulator and not steal the focus or whatever she's doing I'm using win.post. I have got it working for single key strokes (e.g. F1), but can't work out how to do combinations (e.g alt+enter, or ctrl+G).
How can I send a key combo? e.g. alt+enter
Here's my code for a single key:
local kb = libs.keyboard; local win = libs.win; local device = libs.device; -- Commands local WM_KEYDOWN = 0x100; local WM_KEYUP = 0x101; local VK_ESCAPE = 0x1B; local VK_F1 = 0x70; -- Key Simulation Helper function KeyHelper(vk) local hwnd = win.window("ePSXe.exe"); if (hwnd) then win.post(hwnd, WM_KEYDOWN, vk, 0); os.sleep(100); win.post(hwnd, WM_KEYUP, vk, 0); end end [email protected] Command 1 actions.command1 = function () KeyHelper(VK_F1); end