Sign in to follow this  
Followers 0
BeZ

Problem with loop delay

6 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



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


[center]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.[/center]

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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?

TimerInt/Diff?

Share this post


Link to post
Share on other sites

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')

[center]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.[/center]

Share this post


Link to post
Share on other sites

Thanks Smoke N this is what I was looking for.

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