Skip to content
JamilCPUPublic

About

PowerShell script that samples the foreground Windows application and totals active time per process.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

16 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AppLogger

A small PowerShell experiment that tracks which Windows application is in the foreground and accumulates how many seconds each process has been active. It was built to learn PowerShell and Win32 interop, as a starting point for personal screen-time tracking.

Stack

  • PowerShell (Windows)
  • Win32 user32.dll GetForegroundWindow via Add-Type (inline C#)

Running

From a PowerShell session on Windows:

cd scripts/collection
./Collect.ps1

The script loops forever. Each iteration it picks a random 5 to 35 second wait, looks up the process that owns the foreground window, and adds the wait time to that process's running total. Every few iterations it writes the totals to output/userData.txt. Stop it with Ctrl+C.

The relative output path means the script must be started from scripts/collection.

Project layout

  • scripts/collection/ - the foreground-window sampler (Collect.ps1) and its helpers
  • scripts/storage/ - a stub save script
  • scripts/report/ - empty placeholders for a future report
  • output/ - sample output from a local run

Status

Work in progress. Only the collection loop works. The storage and report scripts are empty or placeholder stubs, and the sampling is coarse (random intervals, not exact timing).

About

PowerShell script that samples the foreground Windows application and totals active time per process.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages