Search code examples
javascriptautohotkeykeypresskeystroke

Triggering keystroke from javascript


I have a simple html/js application, which will run locally. If certain conditions are met, I need to simulate a keystroke (e.g. 'a') in a way that AutoHotkey program, which is running in the background, would register it and therefore launch a script.

Triggering jQuery keypress and such will not help, as it stays inside the browser and AHK, which runs in the background as a separate program, won't register it.

Is it possible to achieve this within js? If not, what would be the best way to approach the problem?


Solution

  • I would like to say that "whats runs in browser stays in browser" ...

    but f.e. you can set clipboard value in browser and then use OnClipboardChange event in autohotkey to detect it.

    Another way would be to use Flash / browser plugin / server side script (since this is localhost) / to modify some file and watch it with autohotkey.