Sending a Key Stroke to a Background App is Not Working / Workaround Suggestions

I have a game running in the background which has a logout timer which I can negate with a macro which presses the space bar every 1-5 mins. the macro presses and hold the space bar, pauses for 0.2 seconds then releases it, to give a more human interaction. I want to be able to run this game as a background app and have this script keep me logged in, whilst I use other windows in the foreground without interfering! previously I have had a whole virtual machine running to do this but its quite tiresome. I just found the send keystroke to background application feature and tried that out: this features is sending the keystroke to my foreground application and not the background. any suggestions or workarounds would be appreciated!

I made similar experiences some time ago. Sometimes it worked, but often not, IIRC. (It was also a game, but I don’t remember which.)

Yes, I'm afraid that is the case. Keyboard Maestro sends the keystroke to the application, but the application (and the system) does not really expect to receive keystrokes in the background, and so some things work and some things don't. Basically, this is one of these “out there” features that is a bonus when it works.

1 Like

do you know a work around I could use for this? im thinking it could be done with an AppleScript module?

I doubt it.

Run it on a spare Mac maybe.