Vegar Posted January 1, 2009 Share Posted January 1, 2009 (edited) Is there any way not to make it say (for example): 5726.1654567876 sec... i want it to say: 01:35:26 (hour:min:sec) how? have checked the help file but did not find the answer to my problem. Edited January 1, 2009 by Vegar Link to comment Share on other sites More sharing options...
-Ultima- Posted January 1, 2009 Share Posted January 1, 2009 (edited) Local $iTimerDiff = 5726000 ; should be a value returned by TimerDiff() ConsoleWrite(_TimerFormat($iTimerDiff) & @CRLF) Func _TimerFormat($iTimerDiff) $iTimerDiff = Floor($iTimerDiff / 1000) Local $iSEC = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Local $iMIN = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Local $iHOUR = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Return StringFormat("%.2d:%.2d:%.2d", $iHOUR, $iMIN, $iSEC) EndFunc Edited January 1, 2009 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] Link to comment Share on other sites More sharing options...
Vegar Posted January 1, 2009 Author Share Posted January 1, 2009 ok, Thanx.. but i'm kind of a noob with autoit so i could not find out where in the script i shoud put it. so could i get some help? Where can i copy it in, in this (for example): #include <GuiConstants.au3> $itimerdiff = TimerInit() GuiCreate("Sample GUI", 400, 400) $Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Knapp_1 MsgBox(0, "Running Time", TimerDiff($itimerdiff)/1000&" seconds") EndSelect Wend GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Link to comment Share on other sites More sharing options...
-Ultima- Posted January 1, 2009 Share Posted January 1, 2009 (edited) expandcollapse popup#include <GuiConstants.au3> $itimerdiff = TimerInit() GuiCreate("Sample GUI", 400, 400) $Knapp_1 = GuiCtrlCreateButton("Knapp", 160, 160, 100, 30) GUISetState () While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Knapp_1 MsgBox(0, "Running Time", _TimerFormat(TimerDiff($itimerdiff))&" (hour:min:sec)") EndSelect Wend Func _TimerFormat($iTimerDiff) $iTimerDiff = Floor($iTimerDiff / 1000) Local $iSEC = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Local $iMIN = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Local $iHOUR = Mod($iTimerDiff, 60) $iTimerDiff = Floor($iTimerDiff / 60) Return StringFormat("%.2d:%.2d:%.2d", $iHOUR, $iMIN, $iSEC) EndFunc Edited January 1, 2009 by -Ultima- [ WinINet.au3 | Array.au3 (Optimized) | _UnixTimeParse() ] 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