Braese Posted December 22, 2008 Posted December 22, 2008 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...
Zedna Posted December 22, 2008 Posted December 22, 2008 Post code you have. You might try also ControlGetFocus(). Resources UDF ResourcesEx UDF AutoIt Forum Search
Braese Posted December 22, 2008 Author Posted December 22, 2008 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
Zedna Posted December 22, 2008 Posted December 22, 2008 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 Resources UDF ResourcesEx UDF AutoIt Forum Search
youknowwho4eva Posted December 22, 2008 Posted December 22, 2008 Make your while loop While winactive("whatever") make another while loop While winnotactive("whatever") sleep(100) wend Giggity
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now