Sign in to follow this  
Followers 0
brodie28

Urgent help needed... Script needs to break every six hours.

5 posts in this topic

I need the script to take a break every six hours for half an hour.... This is how I tried to do it.

Please forgive the crappy variable naming and etc.

While 1

$dif = Timerdiff($begin)
$qwe = 21600000 * $number


If $dif > $qwe Then
    sleep(1800000)
    $number = $number + 1
EndIf

<my function goes here>

sleep(50000)

Wend

Share this post


Link to post
Share on other sites



Forgot to add...

What happens at the moment is it takes a break after six hours... And then never starts up again.

Share this post


Link to post
Share on other sites

Cant you just Sleep() for 6 hours?


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

Share this post


Link to post
Share on other sites

I need the script to take a break every six hours for half an hour.... This is how I tried to do it.

Please forgive the crappy variable naming and etc.

While 1

$dif = Timerdiff($begin)
$qwe = 21600000 * $number


If $dif > $qwe Then
    sleep(1800000)
    $number = $number + 1
EndIf

<my function goes here>

sleep(50000)

Wend

after 6 hours of running...

$qwe = 21600000 * $number (21600000 = 6 hours)

then the program sleeps for 1800000 or 30 minutes

* so

the only reason it sleeps at all if after $dif > 6 hours

( other than the 5 seconds )

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

I need the script to take a break every six hours for half an hour.... This is how I tried to do it.

Please forgive the crappy variable naming and etc.

While 1

$dif = Timerdiff($begin)
$qwe = 21600000 * $number
If $dif > $qwe Then
    sleep(1800000)
    $number = $number + 1
EndIf

<my function goes here>

sleep(50000)

Wend
Repeats _MyFunction() forever, taking a 30min break every 6hr:

$iTimer6 = TimerInit()
While 1
     _MyFunction() ; <my function goes here>
     If TimerDiff($Timer6) >= 1000 * 60 * 60 * 6 Then ; If 6 hours have passed...
          Sleep(1000 * 60 * 30) ; 30min delay
          $Timer6 = TimerInit() ; Restart 6 hour timer
     EndIf
Wend

:whistle:


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