Local $tmr, $bStarted = False, $iTap = 0 GUICreate("Tap - BPM Counter", 258, 146, 192, 124) $hBPM = GUICtrlCreateLabel("0", 16, 16, 228, 65, 1) GUICtrlSetFont(-1, 48, 800, 0, "Arial") $hTap = GUICtrlCreateButton("Tap", 16, 96, 147, 33) $hReset = GUICtrlCreateButton("Reset", 168, 96, 75, 33) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case -3 Exit Case $hTap If Not $bStarted Then $bStarted = True $tmr = TimerInit() EndIf $iTap += 1 GUICtrlSetData($hBPM, Round($iTap * (60 / (TimerDiff($tmr) / 1000)), 2)) GUICtrlSetData($hTap, "Tapped " & $iTap & " in " & Round(TimerDiff($tmr) / 1000, 2) & "s") Case $hReset GUICtrlSetData($hBPM, 0) GUICtrlSetData($hTap, "Tap") $bStarted = False $iTap = 0 EndSwitch WEnd