alfa Posted May 26, 2011 Share Posted May 26, 2011 Hello , I want to learn something. This If funtion here wait for the CPU and sleeps till it is below desired range. I want to make that check on every mouseclick down there. Is there a shorter way than writing this IF every time ? ControlClick("\\himini-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn25") Sleep(2000) ;~ ; successful? Then enter loop If @error=0 And IsArray($poCounter) Then $iCounterValue=Round(_PDH_ProcessObjectUpdateCounters($poCounter,0)/$_PDH_iCPUCount) Do Sleep(200) $iCounterValue=_PDH_ProcessObjectUpdateCounters($poCounter,0) If @error=32 Then ExitLoop ; Process can no longer be found $iCounterValue=Round($iCounterValue/$_PDH_iCPUCount) If $iCounterValue > 30 Then Sleep (100) EndIf Until $iCounterValue = 0 EndIf ControlClick("\\himini-svr-01\production\BrioRpt\asp\5519_capacity_report_short.bqy - Windows Internet Explorer", "", "StdBtn1") Sleep (2000) MouseClickDrag("left", 74, 469, 329,885) MouseClickDrag("left", 69, 357, 367,885) MouseClickDrag("left", 77, 374, 407,885,0) MouseClickDrag("left", 75, 759, 476,885) MouseClickDrag("left", 71, 583, 545,885) MouseClickDrag("left", 78, 598, 614,885) MouseClickDrag("left", 72, 565, 673,885) MouseClickDrag("left", 74, 678, 329,885) MouseClickDrag("left", 74, 900, 237,900) MouseClickDrag("left", 74, 726, 276,900) MouseClickDrag("left", 74, 934, 317,900) MouseClickDrag("left", 74, 438, 370,900) Link to comment Share on other sites More sharing options...
hannes08 Posted May 26, 2011 Share Posted May 26, 2011 Hi alfa, you could write a function for that. Func _sleepUntilXX() $iCounterValue=Round(_PDH_ProcessObjectUpdateCounters($poCounter,0)/$_PDH_iCPUCount) Do Sleep(200) $iCounterValue=_PDH_ProcessObjectUpdateCounters($poCounter,0) If @error=32 Then ExitLoop ; Process can no longer be found $iCounterValue=Round($iCounterValue/$_PDH_iCPUCount) If $iCounterValue > 30 Then Sleep (100) EndIf Until $iCounterValue = 0 EndIf Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
alfa Posted May 26, 2011 Author Share Posted May 26, 2011 Hi Thanks for the answer But i dont know how to recall it between those mouse cliks ? MouseClickDrag("left", 74, 469, 329,885) MouseClickDrag("left", 69, 357, 367,885) MouseClickDrag("left", 77, 374, 407,885,0) MouseClickDrag("left", 75, 759, 476,885) How should i insert it between ? Link to comment Share on other sites More sharing options...
hannes08 Posted May 26, 2011 Share Posted May 26, 2011 How 'bout sth like: MouseClick(xxxx) _SleepUntilXX() MouseClick(xxxx) Please consider reading the help file article under "Language Reference" => Functions. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
alfa Posted May 26, 2011 Author Share Posted May 26, 2011 I did. I only ask here after i read through help file. It is most likely that i dont understant them thanks for answer again. Link to comment Share on other sites More sharing options...
MvGulik Posted May 26, 2011 Share Posted May 26, 2011 (edited) nevermind. Edited June 28, 2011 by iEvKI3gv9Wrkd41u "Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions.""The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014) "Believing what you know ain't so" ... Knock Knock ... 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