Advertisement
applehelpwriter

Application monitor

Jun 17th, 2013
869
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --script by Applehelpwriter 2013 / www.applehelpwriter.com
  2. (*
  3. this little script will keep track of which app is in use and for how long
  4. it deposits and updates a .txt file on your desktop
  5. you can open the file and watch it in real time or just use it to collect data for later
  6.  
  7. note the script is an endless loop; it won't quit till you quit it manually
  8.  
  9. to use it, paste into AS editor and hit 'run'; hit 'stop' when you've had enough
  10. else set it up in launch agents or cron jobs
  11. *)
  12.  
  13. set front_app to (path to frontmost application as text)
  14. set _start to current date
  15.  
  16. repeat
  17.     delay 5
  18.     set current_app to (path to frontmost application as text)
  19.     if current_app is not equal to front_app then
  20.         set _stop to current date
  21.         do shell script "echo " & front_app & " was active from " & _start & " until " & _stop & " >> ~/Desktop/log.txt"
  22.         set front_app to current_app
  23.         set _start to current date
  24.     end if
  25. end repeat
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement