Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Record PC Activity based on file/app focus
I want to audit where I spend my time day after day to get a better handle of how I spend my time.

(e.g. did I spend more time writing a macro then it would have to just do something manually in the first place? or how much time do I actually spend on the internet? What sites?)

I would think this is simple but not sure how to monitor changes in focus.

Can I write something that will:
Start by writing time and date, current file and application in focus to say a text file (preferably an excel spreadsheet)
Then when focus changes, write another entry

Is this feasible?
A humorous (because it's so true) definition of a lifehacker: someone who spend 1 hour and 55 minutes developing an automated way of doing something that would have taken 2 hours to do manually.

If you work for a large organization which allows you to propagate your lifehackers (macro scripts, etc), than you may spend days, months, years automating that 2 hour task "for the greater good"


from wikipedia:

Life hack
From Wikipedia, the free encyclopedia
Jump to: navigation, search
The term life hack refers to productivity tricks that programmers devise and employ to cut through information overload and organize their data.

The original definition of the term life hack referred to quick-and-dirty shell scripts and other command line utilities that filtered, munged and processed data streams like email and RSS feeds.[1][2] Examples of these types of life hacks might include utilities to synchronize files, track tasks, remind yourself of events or filter email.

As the meme spread, the definition of the term expanded. Today, anything that solves an everyday problem in a clever or non-obvious way might be called a life hack. The term became popularized in the blogosphere and is primarily used by geeks who suffer from information overload or those with a playful curiosity in the ways they can accelerate their workflow.

"Life" refers to an individual's productivity, personal organization, work processes or any area the hacker ethic can be applied to solve a problem. The terms hack, hacking, and hacker have a long history of ambiguity in the computing and geek communities, particularly within the open source crowds.

[edit] Popularization
British technology journalist Danny O'Brien coined the term life hack after polling a group of productive geeks on the details of their work processes.[3] O'Brien discovered a pattern among these super-productive programmers: that they devised and used "embarrassing" scripts and shortcuts to get their work done.[1]

O'Brien summarized his research in a presentation called Life Hacks: Tech Secrets of Overprolific Alpha Geeks at the O'Reilly Emerging Technology Conference in San Diego, California in February 2004.[4] After his presentation, use of the term life hack spread in the tech and blogging community.

For a brief period of time after the conference, O'Brien worked on developing a web site devoted to life hacks which never launched.[1][5]

In September of 2004, Merlin Mann launched, a topical Blog dedicated to productivity tricks and life hacks, on which Mann invented the Hipster PDA.

Blog network Gawker Media launched a blog dedicated to life hacks,, in January of 2005. Independent blogger Leon Ho launched in May of 2005.[6] Eventually O'Brien redirected to

O'Brien and Mann co-write a column entitled "Life Hacks" for O'Reilly's Make magazine which debuted in February of 2005. O'Brien and Mann also co-presented a session called "Life Hacks Live" at the 2005 O'Reilly Emerging Technology conference.[7]

The American Dialect Society voted lifehack (one word) as the runner-up for "most useful word of 2005" behind podcast.[8]

[edit] See also
Zen Habits
Appropriate technology

[edit] References
^ a b c Interview: father of "life hacks" Danny O'Brien
^ Cory Doctorow's notes from Danny O'Brien's first Life Hacks presentation
^ Hacking Toward Happiness - TIME
^ O'Reilly Emerging Technology Conference 2004
^ Life Hacks - pre-Alpha
^ O'Reilly Emerging Technology Conference 2005
^ Words_of_the_Year_2005.pdf
Retrieved from ""
Categories: Hacking (academia) | Personal life
I am definitely a life hacker. I visit about every day.

I suspect anyone that uses QM is in one way or another.

Spend 2hrs automating what would take 2hrs manually only to save 110 minutes every subsequent time.

Thanks for the reference. Any idea how to code this though?

The pieces I need:
-how to capture the app in focus's name
-how to capture the filename in focus
-how to trigger every time focus changes
-how to include a tab or carriage return when writing to a file

Very quick
not a complete "app" of course
I sure Gintaras could answer a trillion times better - maybe something with the win or acc triggers. Here I just used the left click

Look in the help file under win and also check out the text dialog in the QM toolbar

Trigger #L 0x9     Help - how to add the trigger to the macro
Copy      Help
int+ Time1 = GetTickCount
int TimeBetweenLtClicks = Time1 - Time2
out "TimeBetweenLtClicks = %i ms" TimeBetweenLtClicks
str TimeStamp.time("ddd',' MMM dd yyyy" "HH:mm:ss")

int h=win(mouse)
str sn sc
out sc.getwinclass(h)
out sn.getwintext(h)

int+ Time2 = GetTickCount

_s.format("TimeStamp:[9]%s[]TimeBetweenLtClicks:[9]%i ms[]Window Name:[9]%s[]Wndow Class:[9]%s" TimeStamp TimeBetweenLtClicks sn sc); _s.setfile("Sample.txt")
out _s

Copy      Help
;Writes your time spent in each program to a MS Access database (mdb file).
;Creates new table each day. Like "04_05_2009", "05_05_2009", ...
;;;;When day changes, writes new previous program's time span to new day's table (actually not tested).
;;;;Writes time spent in hibernation or when you are away (actually not tested).
;;;;Currently there is no Pause function.
;;;;Logs only program exe names. Does not log friendly names and window titles.
;;;;And maybe more.
;;;;Don't know is it bad or good, but I did not use Excel because it is easier for me to use database functions but with Excel I don't know how to add tables (sheets).
;;;;For all these reasons, it is almost not usable. Use it as an example. Extend it.
;;;;MS Jet SQL knowledge probably will be needed. You can find the reference in MS Access help, if installed.


;Before using this code, change the file path/name. The file must exist. Create it in MS Access, can be empty or not.
;For testing, run this macro. Press Pause to stop.
;;;Place all this code in a function (name not important).
;;;Change 3 to 0. It will not show debug info and will not drop today's table when started.
;;;Run the function.
;;;Assign 'QM file loaded' trigger (not sync).
#compile "__LogMyDay"
LogMyDay x
x.Start("$personal$\log_my_day.mdb" 3)

Attached Files
.qml   LogMyDay.qml (Size: 3.69 KB / Downloads: 182)

Forum Jump:

Users browsing this thread: 1 Guest(s)