Jump to content

Can I use > with TimerDiff?


 Share

Recommended Posts

Every time I use a ">" it says it was expecting a "=".

Any pointers?

$Begin = TimerInit()
    
    $i = 0
Do
    If TimerDiff($begin)/1000 > 15 Then $i + 1 Endif
    Sleep(500)
Until $i = 1

Edit*Guess topic title should of say'd If timerdiff.

Edited by Orgins

I'm a newbie.Sorry if I don't reposed to your replays very fast.

Link to comment
Share on other sites

Every time I use a ">" it says it was expecting a "=".

Any pointers?

$Begin = TimerInit()
    
    $i = 0
Do
    If TimerDiff($begin)/1000 > 15 Then $i + 1 Endif
    Sleep(500)
Until $i = 1

$Begin = TimerInit()
    
    $i = 0
Do
    If TimerDiff($begin)/1000 > 15 Then $i += 1;Endif
    Sleep(500)
Until $i = 1
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I get the same pop up. Expecting a "=".

Are you sure you tested with the code I posted?

Where is it expecting the "="?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

I get the same pop up. Expecting a "=".

Then you didn't use martin's code.

There were two things wrong with your code, and neither has anything to do with TimerDiff():

1. Your syntax is wrong for incrementing $i in the 'Then' portion of the 'If' line -- martin's corrected it.

2. When you put an If/Then condition on one line, you don't use EndIf -- martin's code corrected that by commenting it out.

If you had run martin's code, it would have worked. If you were running it in SciTE the console would tell you exactly where to look.

:)

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