 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tally
Joined: 06 Apr 2008 Posts: 7
|
Posted: Sat Aug 02, 2008 11:38 pm Post subject: AHK Stopwatch |
|
|
I never really mess with ahk that much anymore and I've been going through stuff on an old flash drive and found this. It's pretty simple, its not meant to be anything but that either.
| Code: | ;Stopwatch.ahk
#NoEnv
#singleinstance force
timerm := "00"
timers := "00"
stopped := "0"
Gui, Add, Text, x67 y22 w60 h20 vTText, %timerm%:%timers%
Gui, Add, Button, x2 y42 w80 h20 vPause, Pause
Gui, Add, Button, x82 y42 w80 h20 vReset, Reset
Gui, Show, h69 w165, Stopwatch
Settimer, Stopwatch, 1000
Return
Stopwatch:
timers += 1
if(timers > 59)
{
timerm += 1
timers := "0"
GuiControl, , TText , %timerm%:%timers%
}
if(timers < 10)
{
GuiControl, , TText , %timerm%:0%timers%
}
else
{
GuiControl, , TText , %timerm%:%timers%
}
return
ButtonPause:
if(stopped = 0)
{
Settimer, Stopwatch, off
stopped = 1
}
else
{
Settimer, Stopwatch, 999
stopped = 0
}
return
ButtonReset:
timerm := "00"
timers := "00"
GuiControl, , TText , %timerm%:%timers%
return
GuiClose:
GuiEscape:
ExitApp
return
|
Hopefully someone can learn from it. |
|
| Back to top |
|
 |
mtman1020
Joined: 08 Aug 2008 Posts: 12
|
Posted: Mon Aug 11, 2008 7:35 pm Post subject: Re: AHK Stopwatch |
|
|
| tally wrote: | I never really mess with ahk that much anymore and I've been going through stuff on an old flash drive and found this. It's pretty simple, its not meant to be anything but that either.
....Code ......
Hopefully someone can learn from it. |
Thanks!! I really appreciate the script! I needed a simple stopwatch to keep track of how long I spend helping others at work because we have a new tracking program and we have to account for every minute of the day now anyway, I did a couple little modifications to give me exactly what I need... (basicly the time I started as well as the length of time spent)
| Code: | ;Stopwatch.ahk
#NoEnv
#singleinstance force
Run:
timerm := "00"
timers := "00"
stopped := "0"
StartTime := A_Hour . ":" . A_Min . ":" . A_Sec
StopTime := "00:00:00"
Gui, Add, Text, x40 y12 w160 h20 vStartTime, Start = %StartTime%
Gui, Add, Text, x40 y32 w160 h20 vTText, Duration = %timerm%:%timers%
Gui, Add, Text, x40 y52 w160 h20 vStopTime, Stop = %StopTime%
Gui, Add, Button, x5 y80 w40 h20 vPause, Pause
Gui, Add, Button, x55 y80 w40 h20 vReset, Reset
Gui, Add, Button, x105 y80 w40 h20 vStop, Stop
Gui, Add, Button, x155 y80 w40 h20 vStart, Start
Gui, Show, h100 w200, Stopwatch
Settimer, Stopwatch, 1000
Return
Stopwatch:
timers += 1
if(timers > 59)
{
timerm += 1
timers := "0"
GuiControl, , TText , Duration = %timerm%:%timers%
}
if(timers < 10)
{
GuiControl, , TText , Duration = %timerm%:%timers%
}
else
{
GuiControl, , TText , Duration = %timerm%:%timers%
}
return
ButtonPause:
if(stopped = 0)
{
Settimer, Stopwatch, off
stopped = 1
}
else
{
Settimer, Stopwatch, 999
stopped = 0
}
return
ButtonReset:
timerm := "00"
timers := "00"
StartTime := A_Hour . ":" . A_Min . ":" . A_Sec
StopTime := "00:00:00"
GuiControl, , StartTime , Start = %StartTime%
GuiControl, , TText , Duration = %timerm%:%timers%
GuiControl, , StopTime , Stop = %StopTime%
return
ButtonStop:
StopTime := A_Hour . ":" . A_Min . ":" . A_Sec
if(stopped = 0)
{
Settimer, Stopwatch, off
stopped = 1
}
else
{
Settimer, Stopwatch, 999
stopped = 0
}
GuiControl, , StartTime , Start = %StartTime%
GuiControl, , TText , Duration = %timerm%:%timers%
GuiControl, , StopTime , Stop = %StopTime%
return
ButtonStart:
Gui, Destroy
GoTo Run
GuiClose:
GuiEscape:
ExitApp
return
|
It works differently than I thought I would write it, but it works great and I had to do very little work to get what I needed.
Thanks again! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|