Mike23 Posted August 28, 2010 Share Posted August 28, 2010 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 More sharing options...
wakillon Posted August 28, 2010 Share Posted August 28, 2010 (edited) 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 #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 August 29, 2010 by wakillon 0uwe 1 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Mike23 Posted August 30, 2010 Author Share Posted August 30, 2010 thank for those 2 inputs, gona look @ them in about 2 hours to see if i can get ut to work wil let you guys know how it goes h2k Link to comment Share on other sites More sharing options...
wakillon Posted August 30, 2010 Share Posted August 30, 2010 thank for those 2 inputs, gona look @ them in about 2 hours to see if i can get ut to work wil let you guys know how it goesh2kglad to help you AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now