I am trying to use this code with AutoHotkey but got the following error: SetTimer's second parameter is invalid.
Here is my code:
#Persistent
MyTime := 15 * 60
SetTimer, ShutdownNow, MyTime
return
ShutdownNow:
Shutdown, 1
return
I also tried:
MyTime = 15 * 60
SetTimer, ShutdownNow, %MyTime%
But I am still get the same error. What can be the problem?
I tested this example and it works fine for me:
#Persistent
MyTime := 15 * 60
SetTimer, ShutdownNow, %MyTime%
return
ShutdownNow:
Shutdown, 1
return
I only replaced SetTimer, ShutdownNow, MyTime
with SetTimer, ShutdownNow, %MyTime%
.
If you tried and it does not work for you:
Use AutoHotkey from http://ahkscript.org/ . You should always use AutoHotkey from http://ahkscript.org/ (current version, new official website)! AutoHotkey from autohotkey.com is outdated and you may have some problems running scripts with it!
Make sure you saved script before running it.
Run it with administrator privileges.