Blog Archives

how to log time spent using apps

My_Work_Desk_by_animae_rian



If you are looking for a way to log how long a user (such as yourself!) is spending time in a given app, or to collect data on your pattern of work over time, this little script should do the trick.

Update: I’ve recently written a Cocoa-app that includes this function. Take a look at OSXClock here. 🙂

It will create and keep a running log file (called ‘log.txt’) on your Desktop indicating which apps have been in focus on your machine and for how long each time. This could be ideal if you want to keep track of how long you spend working on a particular project either for billing a client or just for checking your own productivity.

How to use:
Open AppleScript Editor and paste the text below into the Editor window. Click the ‘run’ button. When you’ve had enough click the ‘stop’ button. It would be possible to automate running and stopping this, but I’ll leave that for the comments or maybe a later post.

*Note: be sure to click out of the app you’re using and activate Finder before you put the machine to sleep, otherwise the log will include the sleep time in the app’s duration

(see the script on pastebin)

--start of script
set front_app to (path to frontmost application as text)
set _start to current date

repeat
delay 5
set current_app to (path to frontmost application as text)
if current_app is not equal to front_app then
set _stop to current date
do shell script "echo " & front_app & " was active from " & _start & " until " & _stop & " >> ~/Desktop/log.txt"
set front_app to current_app
set _start to current date
end if
end repeat
--end of script

Example log:
You will see the log looks something like this:

Seagate DP1:Applications:Utilities:AppleScript Editor.app: was active from Monday, 17 June 2013 17:20:30 until Monday, 17 June 2013 17:20:35
Seagate DP1:Applications:Adobe InDesign CS6:Adobe InDesign CS6.app: was active from Monday, 17 June 2013 17:20:35 until Monday, 17 June 2013 17:21:15
Seagate DP1:Applications:TextWrangler.app: was active from Monday, 17 June 2013 17:21:15 until Monday, 17 June 2013 17:21:25
Seagate DP1:Applications:Adobe InDesign CS6:Adobe InDesign CS6.app: was active from Monday, 17 June 2013 17:21:25 until Monday, 17 June 2013 17:24:46
Seagate DP1:Applications:TextEdit.app: was active from Monday, 17 June 2013 17:24:46 until Monday, 17 June 2013 17:26:26
Seagate DP1:Applications:Safari.app: was active from Monday, 17 June 2013 17:26:26 until Monday, 17 June 2013 17:45:03
Seagate DP1:Applications:Adobe InDesign CS6:Adobe InDesign CS6.app: was active from Monday, 17 June 2013 17:45:03 until Monday, 17 June 2013 17:46:03
Seagate DP1:Applications:TextEdit.app: was active from Monday, 17 June 2013 17:46:03 until Monday, 17 June 2013 17:46:13

On subsequent runs, you can keep the same log (the script will continue to add to the log on each run) or roll it over by renaming the log.txt on the Desktop and saving it off to somewhere else. If you rename or move the log.txt, then the next time you run the script, it will create a fresh log.txt on your Desktop automatically.

🙂



Featured picture: My Work Desk by ~RianGonzales

will Mountain Lion work on my old mac?



If you’re wondering whether your machine can be upgraded to run OS X 10.8 Mountain Lion, you can check the full list of supported models below.

To find out which model of mac you’ve got, hold down the option key on your keyboard and select

 > About This Mac

Check the ‘Model Identifier’ against this list:

MacBookPro4,1
Macmini5,3
Macmini5,2
Macmini5,1
MacBookPro5,1
MacPro4,1
MacBookPro5,2
iMac8,1
MacBookPro5,4
MacBookAir4,2
iMac11,1
iMac11,2
iMac11,3
MacBookPro8,2
MacBookPro3,1
MacPro5,1
iMac9,1
Macmini3,1
MacBookPro6,1
iMac12,2
iMac12,1
MacBook5,1
MacBook5,2
iMac10,1
MacBookPro7,1
MacBookAir4,1
MacBookPro5,3
MacBookPro6,2
MacBookPro5,5
MacBookAir3,1
MacBookAir3,2
Macmini4,1
Xserve3,1
MacBookAir2,1
MacBookPro8,1
MacBook7,1
MacBookPro8,3
iMac7,1
MacBook6,1
MacPro3,1

Of course, just because your machine’s listed, it doesn’t mean it will necessary meet all the specifications, so be sure to check the tech specs too.

🙂

%d bloggers like this: