Last active
August 19, 2024 19:40
-
-
Save sancarn/6302fcd4f4157aefcdee84aee20f0b66 to your computer and use it in GitHub Desktop.
Activity Watcher - This application monitors the windows you visit on your computer, and how long you visit them for. It was built due to my frustration with inability to remember what to put on my timesheets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetTimer, ActivityWatcher, 150 | |
return | |
ActivityWatcher: | |
if !CurrentTitle | |
{ | |
WinGetTitle, CurrentTitle, A | |
QPC(1) | |
} | |
WinGetTitle, CheckTitle, A | |
tooltip, %CurrentTitle%;%CheckTitle% | |
if trim(CheckTitle) != trim(CurrentTitle) | |
{ | |
;Log change in time to file | |
DeltaTime := QPC(0) | |
sAppend := trim(CurrentTitle) . "," . DeltaTime . "`r`n" | |
FileAppend,%sAppend%,ActivityLog.txt | |
;Get new title and start timer again | |
WinGetTitle, CurrentTitle, A | |
QPC(1) | |
} | |
return | |
;Call QPC(1) to start timer | |
;Call QPC(0) to stop timer and return time difference | |
QPC(R := 0) | |
{ | |
static P := 0, F := 0, Q := DllCall("QueryPerformanceFrequency", "Int64P", F) | |
return ! DllCall("QueryPerformanceCounter", "Int64P", Q) + (R ? (P := Q) / F : (Q - P) / F) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment