Jump to content

Problem with loop delay


BeZ
 Share

Recommended Posts

Here is a part of a script I made:

While 1
    
$Rapide = $Rapide + 1
Sleep (50)
$msg = GUIGetMsg()

Select
Case $Rapide = 18000
ExitLoop

Case $msg = $button_stop
GUIDelete ("compteur")
_FileWriteLog(@ScriptDir & "\Internet.log", "-=| Prix : " & Round($cout, 2) & "$ |=-")
prix ()
EndSelect

WEnd

Do

$cout = $cout + 0.001
$msg = GUIGetMsg()
GUICtrlSetData ($coutpresent, Round($cout, 2) & " $ + taxes")

Sleep (900)

Until $msg = $button_stop

Every hour, $cout should raise of 4.00 but it doesn't. Is this because of the time it takes to do the loop ?

BeZ

Edited by BeZ
Link to comment
Share on other sites

  • Moderators

Well, have you tried lowering the sleep? What is the actual output if it isn't 4.00.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

  • Moderators

It is lower than 4.00 I don't know what number exactly. Is there a way to know how long my loop take in milisecond to execute?

Now that depends on what you have going on in that loop, every line of something to do is going to slow it down... here's an example, they both look the same, but 1 is slower than the other:
Local $nCount = 1, $Time = TimerInit()
Do
Until $nCount = 1
MsgBox(64, 'Info:', Round(TimerDiff($Time), 4) & ' milliseconds')
Local $iCount, $iTime = TimerInit()
Do
    $iCount += 1
Until $iCount = 1
MsgBox(64, 'Info:', Round(TimerDiff($iTime), 4) & ' milliseconds')

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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