I've made a script with 2 SetTimers in it.
The first SetTimer (G-Keys) just needs to check continually if any of the specified windows appears. When it does, it closes the script. Of course it also has to stop checking once the script is closed.
The second SetTimer (StartProgramma) has to do a countdown. So, when the time is up it needs to execute a program that I have specified. So far, so good.
But my problem now is, when the condition SetTimer G-Keys is reached it exit the scripts, but it still executes the program under SetTimer StartProgramma, which I don't want to happen.
So basically what I want is: when one of the windows is matched under the condition SetTimer G-Keys it needs to exit the script, AND also stop executing the file under SetTimer StartProgramma.
I've tried to stop SetTimer StartProgamma with
Code: Select all
SetTimer, StartProgramma, Off
Code: Select all
SetTimer StartProgramma, Delete
I'm all out of ideas how to get this to work...
Can anyone please help me?
PS: The programs in the script are just examples.
Here's my script:
Code: Select all
#NoTrayIcon
#Persistent
#SingleInstance Ignore
SetTitleMatchMode, 3
Gui, New ,, G13
Gui, Add, Picture, w64 h64, C:\Program Files (x86)\Notepad++\notepad++.exe ; Shows icon of file
Gui, Add, Text,, Notepad++ ; Name of program
Gui, +Owner -Caption
Gui, Show
SetTimer, G-Keys, 250
SetTimer, StartProgramma, -3000
return
G-Keys:
If Not WinExist("G1")
{
If Not WinExist("G2")
{
If Not WinExist("G3")
{
If Not WinExist("G4")
{
If Not WinExist("G5")
{
If Not WinExist("G6")
{
If Not WinExist("G7")
{
If Not WinExist("G8")
{
If Not WinExist("G9")
{
If Not WinExist("G10")
{
If Not WinExist("G11")
{
If Not WinExist("G12")
{
}}}}}}}}}}}}
else
{
ExitApp
}
return
StartProgramma:
Run, "C:\Program Files (x86)\IrfanView\i_view32.exe" ; Execute file only when time is up and no G-windows are found
Exitapp
Esc::
ExitApp