Jump to content

hi i made a script and i want it to start over every 4 hours all the script !


 Share

Recommended Posts

1 minute ago, Danp2 said:

TimerInit and TimerDiff

can also be done like that. :)

On the other hand, as per experience in the office, i don't usually shutdown my PC for a couple of days and the script i have running usually runs for a couple days as well. In any case. Thanks for the added info.

~XN~

;) ~XN~ ;)

Link to comment
Share on other sites

@omercraft

You can use _Timers.au3 to control actions without freezing Main script.

#include <Timers.au3>

Local $hGui = GUICreate("Test")
Local $iDelay = 5000 ; run script after 5s
Local $fEnabled = False

ConsoleWrite("Script will now wait " & $iDelay & "ms until enable Module." & @CRLF)

Func Example($1, $2, $3, $4)
    $fEnabled = True
EndFunc

HotKeySet("{esc}", "ExitProgram")

_Timer_SetTimer($hGui, $iDelay, "Example")

Func ExitProgram()
    Exit
EndFunc

While 1
    Sleep(100)
    If $fEnabled Then ConsoleWrite("Function running now." & @CRLF)
WEnd

Or even simple example

Local $iDelay = 5000
Local $iStartTime = TimerInit()

ConsoleWrite("Script will now wait " & $iDelay & "ms until enable Module." & @CRLF)

While 1
    Sleep(100)
    If TimerDiff($iStartTime) > $iDelay Then ConsoleWrite("Script is running now." & @CRLF)
WEnd

 

Edited by Ascer
Link to comment
Share on other sites

@omercraft,

There are samples given in help file where you can check what you need to know, everything was stated there on how to use TimerInit() and TimerDiff().;)

Also, show us what have you've got so far for us to help more...

Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.

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