Sign in to follow this  
Followers 0
PsychicHigh

Pausing a script moment program changes focus

4 posts in this topic

In this script for a bottler for this game I am unable to put in a hotkey for pause as the game captures all hotkeys and will cause the script to not pause. Instead, I want the script to pause the moment the game client is not the active program.

I don't know how to go about doing this. I can litter every second line with

If Not WinActive("game client","") Then WinWaitActive("game client","")

but there is a possibility the script will slow down considerably since it has to check constantly if the window is in focus.

I tried wrapping the working part of the script in

While WinActive("game client","")
...
WEnd

But that waits until it hits WEnd before it checks to see if the client is the window that is in focus.

Looking for any suggestions or ideas on this.

Share this post


Link to post
Share on other sites



You could always use AdlibEnable to poll a search to check every X milliseconds (AdlibEnable() would start where you would want to check the first time)

AdlibEnable('_CheckWindowStatus')

Func _CheckWindowStatus()
    If Not WinActive('window name') Then WinWaitActive('window name')
EndFunc


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

while 1

if WinActive("game client","") then

; do your stuff

endif

wend

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

while 1

if WinActive("game client","") then

; do your stuff

endif

wend

8)

Tried this one, but it didn't kick out of the IF statement the moment the client wasn't in focus.

You could always use AdlibEnable to poll a search to check every X milliseconds (AdlibEnable() would start where you would want to check the first time)

AdlibEnable('_CheckWindowStatus')

Func _CheckWindowStatus()
    If Not WinActive('window name') Then WinWaitActive('window name')
EndFunc
Giving an attempt to this one tonight once the game servers are back on.

Thanks for your input, both of you. Much appreciated :D

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