0000 Posted November 24, 2007 Share Posted November 24, 2007 Can somebody give me example with TimeDiff and TimerInit how to count minutes and if 30minutes gone, then show msgbox ? Thanx Link to comment Share on other sites More sharing options...
Tiger Posted November 24, 2007 Share Posted November 24, 2007 MsgBox(0, "", "Start") Sleep(1800000) MsgBox(0, "", "End") My UDFs:- _RegEnumKey Link to comment Share on other sites More sharing options...
Emiel Wieldraaijer Posted November 24, 2007 Share Posted November 24, 2007 You are asking for an example which is in the helpfile $begin = TimerInit() Sleep(1800000) $dif = TimerDiff($begin) MsgBox(0,"Time Difference",$dif) Best regards,Emiel Wieldraaijer Link to comment Share on other sites More sharing options...
0000 Posted November 24, 2007 Author Share Posted November 24, 2007 Hmm but then my script will stop. And then script woudn't do what he had t odo . More exapmles please Thanx! Link to comment Share on other sites More sharing options...
Emperor Posted November 24, 2007 Share Posted November 24, 2007 Hmm but then my script will stop.Perhaps take a look at AdlibEnable in the help file. Link to comment Share on other sites More sharing options...
Jex Posted November 24, 2007 Share Posted November 24, 2007 (edited) While 1 $Timer = TimerInit() ;Your scripts here $TimerDiff += TimerDiff($Timer) If $TimerDiff >= 1800000 Then MsgBox("","",$TimerDiff) $TimerDiff = 0 EndIf WEnd Edited November 24, 2007 by Jex My scripts : Immediate Window , My Web Browser , Travian , Text Effect , Characters & Words per minute or second , Image Editor (ImageMagick) , Matrix style background effect ( Screensaver ) , Mail Sender , Protectlinks decoder and Rapidshare links checker , Fonts Fetcher , Region determine , Compare pictures , Gradient color box , Mouse Coordinates, Colors, Pixel Search things , Encrypt/Decrypt and embeding file in jpeg thing , Hard disk space monitor , Reflex game , Multiplayer Tic Tac Toe , WLM ( MSN ) personal message changer Link to comment Share on other sites More sharing options...
0000 Posted November 24, 2007 Author Share Posted November 24, 2007 WARNING: $TimerDiff possibly not declared/created yet $TimerDiff += TimerDiff($Timer) Getting error, where's problem ? Link to comment Share on other sites More sharing options...
karman Posted November 24, 2007 Share Posted November 24, 2007 his code is totally wrong.. thats why while 1 $timer = timerinit() do ; do something here while waiting Sleep(10) until timerdiff($timer) >= 1800000; exit loop when 1800 seconds msgbox(0, "", "hello! 30 minutes have passed", 2) wend; and restart.. this code will show a msg box every 30 minutes.. until you exit the program.. Link to comment Share on other sites More sharing options...
Valuater Posted November 24, 2007 Share Posted November 24, 2007 (edited) from Autoit Wrappers;Time Machine #1 ;Minutes/seconds/miliseconds ; Author - Valuater $Minutes = 90 ; will wait 90 minutes Local $60Count = 0, $begin = TimerInit() While $Minutes > $60Count $dif = TimerDiff($begin) $dif2 = StringLeft($dif, StringInStr($dif, ".") -1) $Count = int($dif/1000) $60Count = Int($Count / 60) ToolTip("Minutes Required = " & $Minutes & @CRLF & "Minutes Past = " & $60Count & @CRLF & "Seconds Count = " & $Count & @CRLF & "Mili-Seconds Count = " & $dif2, 20, 20, "Time Machine #1", 1) Sleep(20) WEnd MsgBox(64, "Time-Up!!", "Your " & $Minutes & " minutes have passed ")... and there are alot more great additions to your script in Autoit Wrappers8) Edited November 24, 2007 by Valuater Link to comment Share on other sites More sharing options...
zfisherdrums Posted November 24, 2007 Share Posted November 24, 2007 (edited) Hello 0000, I know it doesn't use TimerX functions as you requested, but Emperor made a good point about AdlibEnable. Here's an example:; This is the function to be called by AdlibEnable... Func ShowMessageBox() MsgBox( 0, "", "Test" ) EndFunc ; Setup our function to be called every 30 minutes... Dim $timeInMilliseconds = 1800000 AdlibEnable( "ShowMessageBox", $timeInMilliseconds ) ; All code below here is simulated script activity Dim $x = 0 While 1 $x += 1 ConsoleWrite( $x & @CRLF) Sleep ( 1000 ) WendJust another way of doing it, that's all.Zach... Edited November 24, 2007 by zfisherdrums Identify .NET controls by their design time namesLazyReader© could have read all this for you. Unit Testing for AutoItFolder WatcherWord Doc ComparisonThis here blog... Link to comment Share on other sites More sharing options...
0000 Posted November 24, 2007 Author Share Posted November 24, 2007 his code is totally wrong.. thats why while 1 $timer = timerinit() do ; do something here while waiting Sleep(10) until timerdiff($timer) >= 1800000; exit loop when 1800 seconds msgbox(0, "", "hello! 30 minutes have passed", 2) wend; and restart.. this code will show a msg box every 30 minutes.. until you exit the program.. That was very good but I added Function between Sleep and it didn't show it I will try other ways Link to comment Share on other sites More sharing options...
crislivinitup Posted November 25, 2007 Share Posted November 25, 2007 You could also use the adlib function which executes a function every so often. It works on the same principle, the only difference is you can run any code you want and when 30 minutes is up, it will stop in the middle of execution to execute that function. Check it out in the help file. "adlib" Link to comment Share on other sites More sharing options...
esmano Posted November 25, 2007 Share Posted November 25, 2007 It also can be done very simple, check this: CODE my_msgbox() ;Trigger messagebox-function Func my_msgbox() Msgbox(0,"","your msgbox") ;your messagebox loop() ; go to the sleep-function EndFunc Func loop() Sleep(1800000) ;wait 30 minutes my_msgbox() ;Go back to the messagebox-function EndFunc Cheers 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