Advertisement
Guest User

Untitled

a guest
Jun 21st, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WindowColor=white         ;timer color. Color name or hex (e.g. white)
  2. WindowAlertColor=red      ;alert color. Color name or hex (e.g. FF0000)
  3. WindowAlertBeep:=1        ;1=alert beep, 0=nobeep
  4. RelativeX:=30             ;x location
  5. RelativeY:=70             ;y location
  6.     Gosub,mainScript                              ;Do not change
  7.     return                                        ;Do not change
  8. F2::                      ;change the reset hotkey here. (e.g. "a", "F1", "Tab")
  9.  
  10.  
  11.  
  12.  
  13.  
  14.     ResetTime = %A_TickCount%
  15.     if (difference>10){
  16.     GuiControl,text,Count,%difference%
  17.     }
  18.     GuiControl,text,Time,0
  19.     gui,color,%WindowColor%
  20.     return
  21.  
  22.     mainScript:
  23.    #SingleInstance force
  24.     Gosub,currentTime
  25.     Gosub,updateGui
  26.     SetTimer,currentTime,500
  27.  
  28.     FillCount := 1
  29.     ResetTime := A_TickCount
  30.     CurrentTime := A_TickCount
  31.     Difference := CurrentTime - ResetTime
  32.     Gui,add,Text, vCount w30 h11 +center,%Difference%
  33.     Gui,-border -caption +alwaysontop +disabled +owner -sysmenu
  34.     Gui,color,%WindowColor%
  35.     Gui,add,Text, vTime w30 h11 +center,%Difference%
  36.     Gui,show
  37.  
  38.     Loop
  39.     {
  40.     ifWinExist, ahk_class SunAwtFrame
  41.     {
  42.     ifWinActive, ahk_class SunAwtFrame
  43.     {
  44.     Gui,+alwaysontop
  45.     }
  46.     else
  47.     {
  48.     Gui,-alwaysontop
  49.     }
  50.     WinGetPos,orx,ory,width,height, ahk_class SunAwtFrame
  51.     winX := orx + RelativeX
  52.     winY := ory + RelativeY
  53.     Gui,show, NA x%winX% y%winy%
  54.     Sleep,500
  55.     }
  56.     else
  57.     {
  58.     Gui,Submit
  59.     Sleep,2000
  60.     }
  61.    
  62.     ;change color and beep 3 seconds before call change, stops beeping after 2 minutes
  63.     if ((Difference>26 and difference<30) or (Difference>56 and difference<60) or (Difference>86 and difference<90) or (Difference>116 and difference<120))
  64.    
  65.     {
  66.     Gui,color,%WindowAlertColor%
  67.     if(WindowAlertBeep)
  68.     {
  69.     SoundBeep, 2000, 100
  70.     }
  71.     }
  72.    
  73.     else gui,color,%WindowColor%
  74.     }
  75.     return
  76.  
  77.     currentTime:
  78.    CurrentTime = %A_TickCount%
  79.     gosub,updategui
  80.     return
  81.     updateGui:
  82.    difference := (CurrentTime - ResetTime)
  83.     difference /= 1000
  84.     GuiControl,text,Time,%difference%
  85.     return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement