Another approach could be to use one script to run your other scripts. A sort of script manager.
How to:
Write a script and add in the scripts you want it to handle. (And an array to hold the pid of the running scripts)
Code: Select all
PIDList := []
ScriptsToControl := []
ScriptsToControl.Push( "Path to my script" )
ScriptsToControl.Push( "Path to another script" )
ScriptsToControl.Push( "You get the point" )
Next, have your script run all of your scripts.
Code: Select all
Loop, % ScriptsToControl.Length() {
Try {
Run, % ScriptsToControl[ A_Index ],,, pid
PIDList.Push( pid )
}Catch {
MsgBox, % "Failed to run: " ScriptsToControl[ A_Index ]
}
}
Next set a timer for however long you want and have it close and rerun your scripts. You can also track your window before it does so.
Code: Select all
SetTimer, ReSet, 30 * 60 * 1000
return
ReSet:
Winget, ActiveWindow , ProcessPath , A
Loop, % PIDList.Length() {
Process, Close, PIDList[ A_Index ]
}
PIDList := []
Loop, % ScriptsToControl.Length() {
Try {
Run, % ScriptsToControl[ A_Index ],,, pid
PIDList.Push( pid )
}Catch {
MsgBox, % "Failed to run: " ScriptsToControl[ A_Index ]
}
}
WinWait, % "ahk_exe " ActiveWindow
WinActivate, % "ahk_exe " ActiveWindow
return