Sign in to follow this  
Followers 0
AzKay

Timing.

14 posts in this topic

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 this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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?

Edited by Manadar

Share this post


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


Link to post
Share on other sites

#4 ·  Posted (edited)

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
Edited by Manadar

Share this post


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


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


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


Link to post
Share on other sites

Try reducing the sleep time to 500



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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 this post


Link to post
Share on other sites

#9 ·  Posted (edited)

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 this post


Link to post
Share on other sites

If @MIN = 0 and @SEC = 0 Then



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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 this post


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


Link to post
Share on other sites

#12 ·  Posted (edited)

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

Edited by Manadar

Share this post


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


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

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