I'm fairly certain there are some real simple ways to do this. Unfortunately, I'm just not that well experienced with AHK to know what they are off the top of my head.
The problem to watch out for with this kind of task is that you don't want to click the mouse or have the keyboard send some characters if either of those actions will cause something to happen that will interfere with what you are doing.
For example, if you click the mouse and it happens to be sitting on top of some app, then you might just start the app running and that could cause you problems. Similarly, if you send some keys when the script "taps" the keyboard, it could interfere with what you are currently doing.
One starting point could be that you don't need to
both click the mouse
and tap something on the keyboard to let the system know you are not AFK. You only need to do
one of these things.
My first thought is that it would be much better if you could just move the mouse instead of clicking it as that is much less likely to cause any problems. Maybe move it one pixel to the left and then move it back one pixel to the right. Or even better, try to move it zero pixels. That just might work too and would have the added benefit that moving the mouse zero pixels would not likely cause you any problems.
I put the number "15" next to loop as a kind of safety valve. This way the script will run for a maximum of 15 minutes.
If you find that it works OK for 15 minutes, then you can adjust the number "15" or just remove it to have it run until you stop it.
You can always stop this process by right-click on the small green AHK icon in the lower right corner of your screen and select "Exit". That will terminate AHK. I suggest that because it may well be the smiplest way for you to terminate the script when you are done.
Code:
Loop, 100 {
MouseMove 0, 0, 0, R
Sleep 60000 ; sleep one minute
}
Instead of moving the mouse zero pixels, it might be good enough to just have the script sleep for a millisecond and then wake up. That might be good enough to convince Windows you are not AFK. You can always try that and it would be better than moving the mouse - if it works.
Code:
Loop, 100 {
Sleep 1 ; sleep one millisecond
Sleep 60000 ; sleep one minute
}
Of course, it's kind of silly to have two "Sleep" statements and if this works, you can probably just remove the "Sleep 1" statement.
You know, I'm sure there are other simple ways of causing Windows to know you are not AFK. I just wish I could think of what they are.
Look up the variable "A_TimeIdlePhysical" in the AHK help file. That is a variable that measures how long it's been since some event last happened that meant you weren't AFK. The documentation for that variable might just discuss some events that identify you are not AFK.
Also, look up the command "Shutdown". That may also have some info on some simple kinds of events you might be able to cause that will force Windows to realize you are not AFK.
Good Luck!