# Timing.

## Recommended Posts

`If @HOUR = 2 or 4 or 6 or 8 or 10 or 12 or 14 or 16 or 18 or 20 or 22 or 24 Then _ReLog()`

Would this work? As in, every 2 hours, it would do the function. Or, Would it call the function even if its like, "4:30" or something? Or not work atall?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

##### Share on other sites

This will not work. You will need to put it like this:

`If @hour = 2 Or @hour = 4 Or @hour = 6 ...`

Edit: I forgot to tell you, you would ofcourse need to loop this. It would probably also call at 4:30 etc.

Do you want to call it every 2 hours or just at the whole hour and skip one?

##### Share on other sites

This will not work. You will need to put it like this:

`If @hour = 2 Or @hour = 4 Or @hour = 6 ...`

Edit: I forgot to tell you, you would ofcourse need to loop this. It would probably also call at 4:30 etc.

Do you want to call it every 2 hours or just at the whole hour and skip one?

Yes, Its in a loop, I want it to call on, every hour. So, at 2am, it would call, then call again at 4am, etc.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

##### Share on other sites

You will have to wait for 4 PM to check if it works.

```While 1
If @MIN = 0 Then
For \$x = 0 to 24 step 2
If @HOUR = \$x Then
;call the function.
EndIf
Next
EndIf
Sleep(50000)
WEnd```

##### Share on other sites

say you add this to a bot.

U can make it Run for 1 hour or what ever then Sleep tell 1-waht ever time is left for 2 hours.

Say this run takes 1 hour and 30 mins. the bot would sleep for 30 mins then rerun.

If so i may need this one day on a bot but till this day nice little 2 hour scrip.

##### Share on other sites

Yes, but what if the script is dynamic. And one time the run may take 20 seconds and the other it will take 2 hours. The run times would be wrong.

##### Share on other sites

You will have to wait for 4 PM to check if it works.

```While 1
If @MIN = 0 Then
For \$x = 0 to 24 step 2
If @HOUR = \$x Then
;call the function.
EndIf
Next
EndIf
Sleep(50000)
WEnd```
Hmm, I ran it, then changed the PC's time to one minute before 4pm, and, it didnt call.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

##### Share on other sites

Try reducing the sleep time to 500

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

##### Share on other sites

I wasnt using sleep time. Ill try adding some x)

EDIT::

No difference.

EDIT::

My mistake, I had it set as 4:59 Hehe, But now, ill have to change it, because, it does the function every second after it hits 00.

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

##### Share on other sites

`If @MIN = 0 and @SEC = 0 Then`

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

##### Share on other sites

```If @MIN = 0 and @SEC = 0 Then
oÝ÷ Ûú®¢×z1qêm!Øjëh×6
Sleep(500)
If @MIN = 0 Then
If @SEC = 0 Then
For \$x = 0 to 24 step 2
If @HOUR = \$x Then
_ReLog()
EndIf
Next
EndIf
EndIf
WEnd```

Well, doesnt really matter, not much difference =P

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

##### Share on other sites

BigDod's script is faster. With @MIN first. AutoIt checks @min, if this is false @sec is never called.

##### Share on other sites

Yes, but what if the script is dynamic. And one time the run may take 20 seconds and the other it will take 2 hours. The run times would be wrong.

Thats why u time your-self say it takes u 1 hour it should take the bot 40 min- 1hour and 15 mins.

Pluess u are maken the Scrip so it should work right?

You did get this timer working right?

##### Share on other sites

I believe, he got this working. However, what your saying could also just be a AdlibEnable with the time parameter called to 2 hours. That's a whole lot easier.

## Create an account

Register a new account

×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...