Jump to content
Sign in to follow this  
Braese

Pause when minimized

Recommended Posts

Braese

Hi,

i wrote a little Hotkey Script for a Game, (Call of Duty 4) in Example. How can i set Script to Pause, when Window is minimized and lost focus. I do some little things with WinWaitActive and WinGetState, but nothing really worked. Perhaps i have a little Blackout at the Moment...

Share this post


Link to post
Share on other sites
Braese

This is what i have now, working. But, Script is using 50% CPU! What can i do here? Something forgotten i think in the while code.

#Include <misc.au3>
Run("iw3mp.exe +set fs_game Mods\promod")

While 1
    If _Ispressed("77") and WinActive("Call of Duty 4","") Then
        Send("{^}")
        Send("{BS}{BS}{BS}connect ip{Enter}")
        Send("{^}")
    Endif
Wend

Share this post


Link to post
Share on other sites
Zedna

To reduce CPU usage add Sleep()

#Include <misc.au3>
Run("iw3mp.exe +set fs_game Mods\promod")

While 1
    If _Ispressed("77") and WinActive("Call of Duty 4","") Then
       Send("{^}")
       Send("{BS}{BS}{BS}connect ip{Enter}")
       Send("{^}")
    Endif
    Sleep(50)

Wend

Share this post


Link to post
Share on other sites
youknowwho4eva

Make your while loop While winactive("whatever")

make another while loop While winnotactive("whatever") sleep(100) wend


Giggity

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  

×