Jump to content

Pause when minimized


Braese
 Share

Recommended Posts

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...

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...