Program to prevent timeout.

In using discord, every 15 min I lose a channel connection due to an inactivity timeout from lack of using mouse or keyboard. Any way I can write an app that would periodically perform a mouse or keyboard event that the OS would presume came from the user instead of just being the activity of a background program? What low-level calls would I make to accomplish this.




See if the command-line tool caffeinate does what you want. You can start it via a Shell.

I will give it a try, but I doubt it will work. I’ve tried the caffinate app already. This prevents the desktop from going to sleep, but discord is specifically looking for mouse or keyboard movement and is affected even when the entire machine and screen are up, alive, and performing other activities. What I’m hoping to find is any low level call I can make to essentially force an OS keyboard or mouse event. Presumably it would be intercepted by whatever program is then currently active, but I could ensure that my Xojo program was active at the time by bring it forward on my internal timer.