Auto close program after X seconds inactivity (in that program)

Using AutoHotkey, I want to auto close a program (e.g. Firefox) after X seconds of inactivity (in that program--i.e. mouse or keyboard activity possibly elsewhere, but none in that program).

What code should I use? Thanks


Solution 1:

It's far too complicated to create with such constraints.

If it is simply computer closes Firefox after 15 minutes of no activity, then that's fine. However, there is no built-in measurement of "no activity within a program", so you'll have to do that part yourself. You will then have to process every keystroke, mouse movement, mouse click, and classify that as Firefox activity or not, and then closing it when 15 minutes of inactivity has occurred.