Jump to content

Script to show elapsed time


Recommended Posts

:)

Can someone help me with a script that displays elapsed time?? I need this in a tooltip or splashtext showing Hour:Minutes:Seconds. A guess a Tooltip windows would be best becuase when I use sample scripts that use a SpashText box, I get a lot of flickering. This script will run during a long software installation to monitor how long the installation takes. :">

Thanks!! :evil:

Link to comment
Share on other sites

:)

Can someone help me with a script that displays elapsed time??  I need this in a  tooltip or splashtext showing Hour:Minutes:Seconds.  A guess a Tooltip windows would be best becuase when I use sample scripts that use a SpashText box, I get a lot of flickering.  This script will run during a long software installation to monitor how long the installation takes.  :">

Thanks!! :evil:

<{POST_SNAPBACK}>

when i was first trying to get GUI's, i made a little stopwatch gui... code could probably use some cleaning up, but should suit your purpose...

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)
$mainwindow = GUICreate("STOPWATCH", 200, 100,-1,-1,-1,$WS_EX_TOPMOST)
$ST = GUICtrlCreateButton("&Start/Stop",-1,50,100,50)
$reset = GUICtrlCreateButton("&RESET",100,50,100,50)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlSetOnEvent($ST,"startstop")
GUICtrlSetOnEvent($reset,"resetit")
$MIN = 00
$SEC = 00
$HR = 00
$lbl = GUICtrlCreateLabel("0" & $HR & ":0" & $MIN & ":0" & $SEC,0,0,200,50,$SS_LEFTNOWORDWRAP)
GUICtrlSetFont($lbl,30)
GUISetState (@SW_SHOW)

$i = 0
While 1
sleep(1000)
if $i = 1 then
if $sec = 59 then
    if $min = 59 then
        $hr = $hr + 1
        $min = 00
        $sec = 00
    else
        $min = $min + 1
        $sec = 00
    endif
else
    $sec = $sec + 1
endif
if $hr < 10 and $min < 10 and $sec < 10 then
GUICtrlSetData($lbl,"0" & $hr & ":0" & $min & ":0" & $sec)
elseif $hr < 10 and $min < 10 then
GUICtrlSetData($lbl,"0" & $hr & ":0" & $min & ":" & $sec)
elseif $hr < 10 then
GUICtrlSetData($lbl,"0" & $hr & ":" & $min & ":" & $sec)
else
GUICtrlSetData($lbl,$hr & ":" & $min & ":" & $sec)
endif
endif
Wend

Func startstop()
if $i = 1 then
$i = 0
else 
$i = 1
endif
EndFunc

Func resetit()
$i = 0
$hr = 00
$min = 00
$sec = 00
GUICtrlSetData($lbl,"0" & $hr & ":0" & $min & ":0" & $sec)
EndFunc


Func CLOSEClicked()
  Exit
EndFunc
Link to comment
Share on other sites

Thanks... :evil:

This is pretty much what I was hopeing for.  :)

I've cleaned it up by removing the Start/Stop & Reset buttons and changed it to a Toolwindow...now it serves the function that I needed.

Thanks again!!

<{POST_SNAPBACK}>

no prob, glad i could help
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...