Hi, I would make a program in AHK that plays in the background and never “freezes”.
AHK can send mouse clicks and keep the processing sketch alive.
(It can also click on buttons in the sketch.)
You can download it at the link @Chrisir provided. It installs fast because it is really light weight.
It can run a program in the background that can detect windows, keys and mouse clicks. Also can it open windows, send keystrokes and mouse clicks. I made a program for someone on the forum,; see here.