Code: Select all
hr := 8
counters:={}
timeSlots := 8
startTime := 930
;build array to store times and counts for each hour
loop % timeSlots
{
counters[A_Index,"st"] := startTime
counters[A_Index,"et"] := startTime + 100
counters[A_Index,"count"] := 0
startTime += 100
}
Counter = 0000 ; Start counter at zero
Gui, Add, Tab,h250,Tab1 | Tab2 ||
Gui, Add, Text, vText, Completed Reports: %Counter%
Gui, Add, UpDown, Range0-1000, 0
Gui, Tab, 2
Gui, Add, Text, vText1 hwndText1Hwnd, 9:30am-10:30am = %Counter%
Gui, Add, Text, vText2 hwndText2Hwnd, 10:30am-11:30am = %Counter%
Gui, Add, Text, vText3 hwndText3Hwnd, 11:30am-12:30pm = %Counter%
Gui, Add, Text, vText4 hwndText4Hwnd, 12:30pm- 1:30pm = %Counter%
Gui, Add, Text, vText5 hwndText5Hwnd, 1:30pm- 2:30pm = %Counter%
Gui, Add, Text, vText6 hwndText6Hwnd, 2:30pm- 3:30pm = %Counter%
Gui, Add, Text, vText7 hwndText7Hwnd, 3:30pm- 4:30pm = %Counter%
Gui, Add, Text, vText8 hwndText8Hwnd, 4:30pm- 5:30pm = %Counter%
Gui, Show,, Report Counter ; Show Gui
return
^d::
;loop
;{
; sleep 200
; ImageSearch FoundX,FoundY, 345,300, 900,700, complete.png
; If ErrorLevel = 0
; break
;}
;loop over time slots
for slot in counters
{
;check if current time is inside time slot
if(timeOfDay>counters[slot].st && timeOfDay<=counters[slot].et)
{
;found correct slot so update slot counter and update text
counters[slot].count ++
hwnd := Text%slot%Hwnd
GuiControlGet, currentText, ,%hwnd%,
currentText := substr(currentText,1,strLen(currentText)-strLen(counters[slot].count)) . format("{:d}",counters[slot].count)
GuiControl,, Text%slot%, %currentText% ; Update Text control with new value
break
}
}
;update global counter
Counter++
GuiControl,, Text, Completed Reports: %Counter%
return
^i::
;simulate increase hour of day
; to get real time of day
/*
timeOfDay := A_now
FormatTime, timeOfDay , timeOfDay , HHMM
tooltip % timeOfDay
*/
hr++
if(hr>23)
{
hr := 0
}
random,min,0,59 ;set to random min
dispHr := mod(hr,12)
if(dispHr == 0)
{
dispHr := 12
}
timeOfDay := format("{:02d}",hr) . format("{:02d}",min)
tooltip % "Current Time: " . format("{:02d}",dispHr) . ":" . format("{:02d}",min) . "`n" . hr
return