Jump to content

why TimerInit/TimerDiff are ignored?


Recommended Posts

You couls probably clean that up a lot just by declaring another local Variable or 2. Without your other functions I can't test thsi but it should work and if you remove the commented code then you have a shorter function. I'm sure it can be shortened even more with a bit more thinking on the subject and knowing what is in the called functions. I'm passing your old $Delay in as a parameter although I have no idea what that value may be.

Func WaitDelay($iDelay);; Pass your old $Delay to here as a parameter
Local $Diff = 0, $iSleepDelay = 0
If $iDelay >= 1 Then $iDelay *= 1000
If ValuesScreen() = 1 Then
         $begin__ = TimerInit()
         while ScreenCheck("MainValuesScreen") = 0
            Sleep(1000) ;; Why so long? 250 is probably sufficient
         wend
      EndIf
        Do
            $Diff = TimerDiff($begin__) * 1000
        Until $Diff >= 1
        $Loop += $ATTEMPTS
        $JOINATTEMPTS = 0
        
         If $Loop >= $BeforeSwitch AND $Count > 0 Then
            $iDelay += 1000
            Sleep($iDelay)
              ;Sleep ( 1000 ) ;; Shouldn't be required
            ;If $Diff < $Duration Then
            ;    Sleep ( ($Duration * 1000) - ($Diff/1000))
            ;Endif
         Else
            $iDelay += 5000
            Sleep($iDelay)
              ;Sleep ( 1000 ) ;; Shouldn't be required
            ;If $Diff < $Duration Then
             ;   Sleep ( ($Duration * 1000) - ($Diff/1000))
            ;Endif
        EndIf
        If $Diff < $Duration Then
            Sleep ( ($Duration * 1000) - ($Diff/1000));;  I know this can be shortened down.
        EndIf
EndFunc

Remember, this is just a guess based on what you posted. Learn to pass parameters to your functions. It can make life a lot simpler.

EDIT: Actually that whole function of yours makes no sense at all and I would seriously take a look at rewriting all of your code if it's written like that. Just look at the lines I commented out to see what I mean, you were dupolicating function calls when there was no need for it.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

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