Jump to content

Interesting things with time.


Recommended Posts

He everyone. I have note that when i activate a timer( it happens every 5 sec) the main script is slow down. I run a counter in main part and it works longer than 20 sec then it was. Is it normal? Is it works in two threads or the main script paused?

;~ Setting timer
$TimerHandle = _Timer_SetTimer($formMain, 5000, "_MsgTimerEvent")

...

;~ Here is my main cycle. $a - is an amount of seconds and it works more longer then it should be.
For $a = Round(GUICtrlRead($InputTimeCircle), -1) To 0 Step -1
        WinSetTitle("Debug", "", "Debug - " & $a)
        Sleep(1000)
    Next
    WinSetTitle("Debug", "", "Debug")

...

Func _MsgTimerEvent($hWnd, $Msg, $iIDTimer, $dwTime)
    
    _Timer_KillTimer($formMain, $TimerHandle)

    $result = SearchImage()
    Switch $result
        Case 1
            DebugInfo("Message!")
            Send("{ENTER}")
        Case 2
            DebugInfo("Connection Lost")
            Send("{ENTER}")
            Restart()
        Case 3
            DebugInfo("Login or password are incorrect")
            Send("{ENTER}")
            Restart()
        Case Else
    EndSwitch
    
    $TimerHandle = _Timer_SetTimer($formMain, 5000, "_MsgTimerEvent")
    
EndFunc ;==>_MsgTimerEvent
Edited by Levenson
Link to comment
Share on other sites

He everyone. I have note that when i activate a timer( it happens every 5 sec) the main script is slow down. I run a counter in main part and it works longer than 20 sec then it was. Is it normal? Is it works in two threads or the main script paused?

It won't be possible to help you without a short script THAT CAN BE RUN, and that SHOWS YOUR ISSUE. The code you provided meets neither requirement.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...