AutoHotkey Community

It is currently May 26th, 2012, 10:35 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: AHK Stopwatch
PostPosted: August 3rd, 2008, 12:38 am 
Offline

Joined: April 6th, 2008, 7:21 pm
Posts: 6
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: AHK Stopwatch
PostPosted: August 11th, 2008, 8:35 pm 
Offline

Joined: August 8th, 2008, 1:40 am
Posts: 36
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 :shock: 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!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: AHK Stopwatch
PostPosted: March 1st, 2012, 11:10 pm 
Offline

Joined: March 1st, 2012, 9:41 pm
Posts: 5
Location: Bothell
I want to start off by saying i have self taught myself starting about 6 mos ago and this is my 3rd day on project about 16 hrs in..

You guys are freaking awesome! I was tasked with creating a timer for my company to track workers progress (they were not happy about that!) and had hit a fat wall because they wanted 6-10 independently operating timers and originally i was working with a timer that i found that was super complicated and could not get it to work right.

Then a light shined down as i was exploring new options and i saw this post.

From it i created:
Code:
#NoEnv
#singleinstance force
Settimer, Stopwatch, off

timerm := "00"
timers := "00"
stopped := "0"
timerm1 := "00"
timers1 := "00"
stopped1 := "0"
timerm2 := "00"
timers2 := "00"
stopped2 := "0"
timerm3 := "00"
timers3 := "00"
stopped3 := "0"
timerm4 := "00"
timers4 := "00"
stopped4 := "0"
timerm5 := "00"
timers5 := "00"
stopped5 := "0"

;StartTime := A_Hour . ":" . A_Min . ":" . A_Sec
;StopTime := "00:00:00"

Gui, Add, Text, x85 y5 w160 h20 vStartTime, Start = %StartTime%
Gui, Add, Text, x40 y52 w160 h20 vStopTime, Stop = %StopTime%
Gui, Add, Text, x155 y30 w60 h20 vTText, %timerm%:%timers%
Gui, Add, Text, x155 y70 w60 h20 vTText1, %timerm1%:%timers1%
Gui, Add, Text, x155 y110 w60 h20 vTText2, %timerm2%:%timers2%
Gui, Add, Text, x155 y150 w60 h20 vTText3, %timerm3%:%timers3%
Gui, Add, Text, x155 y190 w60 h20 vTText4, %timerm4%:%timers4%
Gui, Add, Text, x155 y230 w60 h20 vTText5, %timerm5%:%timers5%
;Gui, Add, Button, x2 y42 w80 h20 vPause, Pause
;Gui, Add, Button, x82 y42 w80 h20 vReset, Reset
Gui, Add, Button, x22 y20 w90 h30 gThe_Main_Gui_StopStart1 , &QC
Gui, Add, Button, x22 y60 w90 h30 gThe_Main_Gui_StopStart2 , &Sketch
Gui, Add, Button, x22 y100 w90 h30 gThe_Main_Gui_StopStart3 , &Tech
Gui, Add, Button, x22 y140 w90 h30 gThe_Main_Gui_StopStart4 , &Pokemon
Gui, Add, Button, x22 y180 w90 h30 gThe_Main_Gui_StopStart5 , &Intimate time
Gui, Add, Button, x22 y220 w90 h30 gThe_Main_Gui_StopStart6 , &Unicorn Dance
Gui, Add, Button, x22 y270 w90 h30 gThe_Main_Gui_Close, &Quit
gui, add, edit, w200 vMyEdit
Gui, Show, h400 w250, Stopwatch
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

Stopwatch1:
timers1 += 1
if(timers1 > 59)
{
   timerm1 += 1
   timers1 := "0"
   GuiControl, , TText1 ,  %timerm1%:%timers1%
}
if(timers < 10)
{
   GuiControl, , TText1 ,  %timerm1%:0%timers1%
}
else
{
   GuiControl, , TText1 ,  %timerm1%:%timers1%
}
return

Stopwatch2:
timers2 += 1
if(timers2 > 59)
{
   timerm2 += 1
   timers2 := "0"
   GuiControl, , TText2 ,  %timerm2%:%timers2%
}
if(timers < 10)
{
   GuiControl, , TText2 ,  %timerm%:0%timers2%
}
else
{
   GuiControl, , TText2 ,  %timerm%:%timers2%
}
return

Stopwatch3:
timers3 += 1
if(timers3 > 59)
{
   timerm3 += 1
   timers3 := "0"
   GuiControl, , TText3 ,  %timerm3%:%timers3%
}
if(timers < 10)
{
   GuiControl, , TText3 ,  %timerm3%:0%timers3%
}
else
{
   GuiControl, , TText3 ,  %timerm3%:%timers3%
}
return

Stopwatch4:
timers4 += 1
if(timers4 > 59)
{
   timerm4 += 1
   timers4 := "0"
   GuiControl, , TText4 ,  %timerm4%:%timers4%
}
if(timers < 10)
{
   GuiControl, , TText4 ,  %timerm4%:0%timers4%
}
else
{
   GuiControl, , TText4 ,  %timerm4%:%timers4%
}
return

Stopwatch5:
timers5 += 1
if(timers5 > 59)
{
   timerm5 += 1
   timers5 := "0"
   GuiControl, , TText5 ,  %timerm5%:%timers5%
}
if(timers < 10)
{
   GuiControl, , TText5 ,  %timerm5%:0%timers5%
}
else
{
   GuiControl, , TText5 ,  %timerm5%:%timers5%
}
return

The_Main_Gui_StopStart1:
if(stopped = 0)
{
   Settimer, Stopwatch, off
   stopped = 1
}
else
{
   Settimer, Stopwatch, 999
   stopped = 0
}
return

The_Main_Gui_StopStart2:
if(stopped = 0)
{
   Settimer, Stopwatch1, off
   stopped = 1
}
else
{
   Settimer, Stopwatch1, 999
   stopped = 0
}
return

The_Main_Gui_StopStart3:
if(stopped = 0)
{
   Settimer, Stopwatch2, off
   stopped = 1
}
else
{
   Settimer, Stopwatch2, 999
   stopped = 0
}
return

The_Main_Gui_StopStart4:
if(stopped = 0)
{
   Settimer, Stopwatch3, off
   stopped = 1
}
else
{
   Settimer, Stopwatch3, 999
   stopped = 0
}
return

The_Main_Gui_StopStart5:
if(stopped = 0)
{
   Settimer, Stopwatch4, off
   stopped = 1
}
else
{
   Settimer, Stopwatch4, 999
   stopped = 0
}
return

The_Main_Gui_StopStart6:
if(stopped = 0)
{
   Settimer, Stopwatch5, off
   stopped = 1
}
else
{
   Settimer, Stopwatch5, 999
   stopped = 0
}
return

The_Main_Gui_Close:
Exitapp


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


and was able to wow my bosses thanks a lot now to add the file append feature.

THANKS AGAIN


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Stigg, toddintr and 7 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group