Looking for a script to close a specific program and then put PC to sleep
-
- Posts: 16
- Joined: 12 Apr 2017, 11:41
Looking for a script to close a specific program and then put PC to sleep
I have a program that i need closing after a certain amount of time, lets say one hour, then i want the PC to sleep straight after, does anyone know of a script that can do this?
Re: Looking for a script to close a specific program and then put PC to sleep
Code: Select all
#Requires AutoHotkey v2.0
winTitle := 'ahk_exe Notepad.exe'
closeAfterMins := 60
SoundBeep 2500
WinWait winTitle
SoundBeep 1500
If !WinWaitClose(,, 60 * closeAfterMins) {
WinClose
SoundBeep 1000
DllCall('PowrProf\SetSuspendState', 'Int', 0, 'Int', 0, 'Int', 0) ; Sleep computer
}
ExitApp