I adapted a little script to shutdown my PC after 30 minutes of inactivity (no keyboard or mouse action detected with A_TimeIdle), but sometimes when I start my PC, I see the first window saying that it will shut down in 5 minutes (i.e. there have been no mouse/keyboard action detected for 1800000 ms/30 minutes).
I haven't made tests yet, , but I'm thinking of setting A_TimeIdle to 0 (but I don't know if I it will work), or maybe make the script move the mouse a little so it will reset A_TimeIdle.
Is there is a better way to avoid this ?
My script:
Code: Select all
#SingleInstance Force
#NoEnv
#Persistent
SetTimer, Arret, 250
return
Arret:
If (A_TimeIdle > 1800000)
MsgBox,, >> Arrêt automatique (Auto Shutdown) <<, L'ordinateur va s'éteindre dans 5 minutes. (The computer will shut down in 5 minutes)`n`nCliquer sur OK pour annuler. (Click OK to abort),60
If (A_TimeIdle > 1860000)
MsgBox,, >> Arrêt automatique <<, L'ordinateur va s'éteindre dans 4 minutes.`n`nCliquer sur OK pour annuler.,60
If (A_TimeIdle > 1920000)
MsgBox,, >> Arrêt automatique <<, L'ordinateur va s'éteindre dans 3 minutes.`n`nCliquer sur OK pour annuler.,60
If (A_TimeIdle > 1980000)
MsgBox,, >> Arrêt automatique <<, L'ordinateur va s'éteindre dans 2 minutes.`n`nCliquer sur OK pour annuler.,60
If (A_TimeIdle > 2040000)
MsgBox,, >> Arrêt automatique <<, L'ordinateur va s'éteindre dans 1 minute.`n`nCliquer sur OK pour annuler.,60
If (A_TimeIdle > 2100000)
Shutdown, 12
Return