DragonBall Posted November 10, 2011 Share Posted November 10, 2011 I made a script like the following: Run("ProgA.exe") While 1 sleep(20) If ProcessExists("ProgA.exe") = 0 Then ProcessClose("ProgB.exe") Exit ElseIf WinActive("ProgA") Then ( let ProgA) do "somethings" EndIf WEnd When I run it, everything work fine. But there is a problem: When I click the mouse to any other program than ProgA, then the windows of ProgA is not active. But in taskmanager, I found that ProgA.exe still use 1%~2% cpu. If I change the sleep timer smaller in "somethings", then ProgA.exe use more cpu. It's weired because when the window of ProgA is not activate, then ProgA will do nothing? Do I miss something? Link to comment Share on other sites More sharing options...
bogQ Posted November 11, 2011 Share Posted November 11, 2011 (edited) well did you code programA to work only if it main win state is active? your missing that script still check if win is active and if process exsist on the other hand i whud do loop probably like this While 1 sleep(20) Select Case WinActive("ProgA") ;let ProgA do somethings Case ProcessExists("ProgB.exe") If Not ProcessExists("ProgA.exe") Then ProcessClose("ProgB.exe") Exit EndIf EndSelect WEnd Edited November 11, 2011 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
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