Sign in to follow this  
Followers 0
Orgins

Can I use > with TimerDiff?

6 posts in this topic

#1 ·  Posted (edited)

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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


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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Works for me.

Share this post


Link to post
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

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