Hammerspoon is quite easy to use, so attempting to cobble together your own thing (that does exactly what you want) might also be feasible. The documentation is decent and the iteration time is short.

It took me about 30 minutes to replicate some Windows/AutoHotKey crap that I wrote myself and have been using for years, and it wasn't painful.