Hi!
I'm working on a script that shows how many hours/minutes/secs I'm working on the computer.
This works perfect, but now I want save every 5 min to a text file to get the total hours.
The problem is that the first 5min work, but then I can't get it work.
The timer must save it to 10min but he doesn't do that.
Here is the script:
#include <GUIConstants.au3>
#include <Date.au3>
Global $Secs, $Mins, $Hour, $Time
;Create GUI
GUICreate("Timer",200, 200)
GUICtrlCreateLabel("00:00:00", 10,10)
GUISetState()
;Start timer
$timer = TimerInit()
AdlibEnable("Timer", 50)
$StartTicks = _TimeToTicks("00:00:00")
While 1
$msg = GUIGetMsg()
;If time is 1 sec -> next time 5 min
if ($Time = "00:00:01") Then
;Set time to 5 min
$EndTicks = $StartTicks + 5 * 60 * 1000
_TicksToTime($EndTicks,$Hour,$Mins,$Secs)
$next = "0" & $Hour & ":0" & $Mins & ":0" & $Secs
;If time is 5min -> show message
msgbox(0,"Next time",$next)
;Filewrite now 5 minutes to a txt file
;If time is 10min -> save time
EndIf
;FileWriteLine("debug.log",@min & ":" & @sec & " ==> after")
Select
Case $msg = $GUI_EVENT_CLOSE
;Show the total time of the program
msgbox(64,"Total time of this session:",$Time)
Exit
EndSelect
Wend
;Function timer
Func Timer()
_TicksToTime(Int(TimerDiff($timer)), $Hour, $Mins, $Secs )
Local $sTime = $Time ; save current time to be able to test and avoid flicker..
$Time = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
If $sTime <> $Time Then ControlSetText("Timer", "", "Static1", $Time)
EndFunc ;==>Timer
I removed the part that must to +5min because that always sucks.
Can anyone please help me?
Thanks!
YoseMite