I am looking for a way to automate the opening and closing of a program based on a timer.
What I am looking for would look like this:
- Open program
- Run program for 5 minutes
- Close program
- Do the above again and again
I am looking for a way to automate the opening and closing of a program based on a timer.
What I am looking for would look like this:
Create a scheduled task using the task scheduler
tool. You can specify the start time (every 5 minutes) and set the "Stop task if it runs longer than" box at 5 minutes!
Create a trigger like this: on the scheduled task to start and stop the task.
You can do this using the free program autohotkey.
Essentially, you would create a loop consisting of opening the program, setting a timer for x minutes, then closing the program.
You will need to look at the following autohotkey commands:
You can also find useful snippets on SuperUser using the autohotkey tag.
Below is a very simple autohotkey script that would need minimal changes on your part to run what you're needing. Lines starting with a semi-colon are comments and can safely be removed:
; Below line keeps this script running until you close it
#Persistent
Loop
{
; Edit the below line to add your program
Run, C:\Program Files (x86)\Example Program\Example_Program.exe
;300000 on the line below is 5 minutes
Sleep, 10000
; Edit the below line to add your program's "Window Title"
; Note this is not the same as the program's name
WinClose, Example Program
}