Jump to content

Looking for a timer proces


 Share

Recommended Posts

hi all,

i am looking for a timer, i know the sleep function but i want an active function.

as example

while 1

Timer()

if $timer15 = 1

.....

$timer15=0

Endif

if $timer40 = 1

.....

$timer40=0

Endif

if $timer4h = 1

.....

$timer4h=0

Endif

if $timer10h = 1

.....

$timer10h=0

Endif

WEnd

func Timer();

every 15min $timer15 = 1;

every 40min $timer40 = 1;

every 4houts $timer4h = 1;

every 10hours $timer10h = 1;

endfunc

is this easy to make? maybe with the windows clock?

ty for your help

h2k

Link to comment
Share on other sites

Try this...

Dim $_TimerInit = TimerInit ( )

While 1
    If _EachXseconds ( 15*60 ) Then ConsoleWrite ( '15 Min are finished ' & @Crlf )
    Sleep ( 50 )
WEnd

Func _EachXseconds ( $_Interval )
    $_TimerDiff = Round ( TimerDiff ( $_TimerInit )/ 1000 )
    If $_TimerDiff >= $_Interval Then
        $_TimerInit = TimerInit ( )
        Return 1
    Else
        Return 0
    EndIf
EndFunc ;==> _EachXseconds ( )

or like that Posted Image

#Include <Date.au3>

Global $iTimer1 = _NowCalc ( )
Global $iTimer2 = _NowCalc ( )

While 1
    $_NowCalc = _NowCalc ( )
    If _DateDiff ( "n", $iTimer1, $_NowCalc ) >= 15 Then  ; 15 min
        ConsoleWrite ( "+>---- 1 $_NowCalc : " & $_NowCalc & @Crlf )
        $iTimer1 = $_NowCalc
    EndIf
    If _DateDiff ( "h", $iTimer2, $_NowCalc ) >= 4 Then  ; 4 hour
        ConsoleWrite ( "!>---- 2 $_NowCalc : " & $_NowCalc & @Crlf )
        $iTimer2 = $_NowCalc
    EndIf
    Sleep ( 100 )
WEnd
Edited by wakillon

AutoIt 3.3.14.2 X86 - SciTE 3.6.0WIN 8.1 X64 - Other Example Scripts

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