Sign in to follow this  
Followers 0
Agent29

If not active window EXIT?

2 posts in this topic

Hello agian! Last time i asked for help you guys were very helpful, Im hoping for some help agian.

My scipt is below, and Everything is working perfectly except for the "IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF" That should be self explanitory, but I want to make it so if the Active windows is not the Specified the script will exit. Right now, it just seems to pause and then as soon and I make the specified windows the active window agian, it starts back up...

; -------------- BEGIN SCRIPT -----------------------------

; First, set some options:

HotKeySet("{Q}", "Terminate")

HotKeySet("{PAUSE}", "TogglePause")

Func Terminate()

Exit 0

EndFunc

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

While 1

WinWaitActive(" Active Window")

Sleep(60)

Send("+{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("Text here")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("Text Here")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("Text here")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{TAB}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{ENTER}")

IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF

Sleep(60)

Send("{Q}")

WEnd

; -------------- END SCRIPT -----------------------------

Share this post


Link to post
Share on other sites



Hello agian! Last time i asked for help you guys were very helpful, Im hoping for some help agian.

My scipt is below, and Everything is working perfectly except for the "IF NOT WinWaitActive(" Active Window","",3) THEN EXIT 0 ENDIF" That should be self explanitory, but I want to make it so if the Active windows is not the Specified the script will exit. Right now, it just seems to pause and then as soon and I make the specified windows the active window agian, it starts back up...

Try something like this

; -------------- BEGIN SCRIPT -----------------------------

; First, set some options:
HotKeySet("{Q}", "Terminate")
HotKeySet("{PAUSE}", "TogglePause")

Func Terminate()
Exit
EndFunc

Func TogglePause()
$Paused = NOT $Paused
While $Paused
sleep(100)
ToolTip('Script is "Paused"',0,0)
WEnd
ToolTip("")
EndFunc

While 1
WinActive(" Active Window")
Sleep(60)
Send("+{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("Text here")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("Text Here")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("Text here")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{TAB}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{ENTER}")
IF NOT WinActive(" Active Window","",3) THEN Exit ENDIF
Sleep(60)
Send("{Q}")
WEnd

; -------------- END SCRIPT -----------------------------
Not tested.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0