Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- WindowColor=white ;timer color. Color name or hex (e.g. white)
- WindowAlertColor=red ;alert color. Color name or hex (e.g. FF0000)
- WindowAlertBeep:=1 ;1=alert beep, 0=nobeep
- RelativeX:=30 ;x location
- RelativeY:=70 ;y location
- Gosub,mainScript ;Do not change
- return ;Do not change
- F2:: ;change the reset hotkey here. (e.g. "a", "F1", "Tab")
- ResetTime = %A_TickCount%
- if (difference>10){
- GuiControl,text,Count,%difference%
- }
- GuiControl,text,Time,0
- gui,color,%WindowColor%
- return
- mainScript:
- #SingleInstance force
- Gosub,currentTime
- Gosub,updateGui
- SetTimer,currentTime,500
- FillCount := 1
- ResetTime := A_TickCount
- CurrentTime := A_TickCount
- Difference := CurrentTime - ResetTime
- Gui,add,Text, vCount w30 h11 +center,%Difference%
- Gui,-border -caption +alwaysontop +disabled +owner -sysmenu
- Gui,color,%WindowColor%
- Gui,add,Text, vTime w30 h11 +center,%Difference%
- Gui,show
- Loop
- {
- ifWinExist, ahk_class SunAwtFrame
- {
- ifWinActive, ahk_class SunAwtFrame
- {
- Gui,+alwaysontop
- }
- else
- {
- Gui,-alwaysontop
- }
- WinGetPos,orx,ory,width,height, ahk_class SunAwtFrame
- winX := orx + RelativeX
- winY := ory + RelativeY
- Gui,show, NA x%winX% y%winy%
- Sleep,500
- }
- else
- {
- Gui,Submit
- Sleep,2000
- }
- ;change color and beep 3 seconds before call change, stops beeping after 2 minutes
- if ((Difference>26 and difference<30) or (Difference>56 and difference<60) or (Difference>86 and difference<90) or (Difference>116 and difference<120))
- {
- Gui,color,%WindowAlertColor%
- if(WindowAlertBeep)
- {
- SoundBeep, 2000, 100
- }
- }
- else gui,color,%WindowColor%
- }
- return
- currentTime:
- CurrentTime = %A_TickCount%
- gosub,updategui
- return
- updateGui:
- difference := (CurrentTime - ResetTime)
- difference /= 1000
- GuiControl,text,Time,%difference%
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement