Sign in to follow this  
Followers 0
alfa

Using a funtion again ?

6 posts in this topic

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)

Share this post


Link to post
Share on other sites



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]

Share this post


Link to post
Share on other sites

Hi :huh2:

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 ?

Share this post


Link to post
Share on other sites

How 'bout sth like:

MouseClick(xxxx)
_SleepUntilXX()
MouseClick(xxxx)

:huh2:

Please consider reading the help file article under "Language Reference" => Functions. ;)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

I did.

I only ask here after i read through help file.

It is most likely that i dont understant them :huh2:

thanks for answer again.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

nevermind.

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

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  
Followers 0