Skip to main content

PowerPro time tracking script

PowerPro is the best utility I know. It allow many good things.

I wrote script that is invoked by some key to track my activities during the day:




;-----------------------------------------------
; log file location - new
;-----------------------------------------------
log_file = "c:/z/log.txt"

alias_l = "LICENSE - "
alias_sr = "SCREEN RECORDER - "
alias_m = "MEETING - "



*Bar show timer_track
*Bar show taskbar

;-----------------------------------------------
; get input from user
;-----------------------------------------------
newnote = input ("Note (l=license, sr=screen recorder, m=meeting)")


;-----------------------------------------------
; general variables
;   last_usedtimer   - name of last used timer (needed for "start")
;   last_barcolor   - last used color (needed for "start")
;   last_htmlbgcolor - background color for HTML report
;
;   timer a = main tasks
;   timer b = work related tasks
;   timer d = delta since last start of task
;   timer z = private tasks
;-----------------------------------------------
if (last_usedtimer=="") do
  last_usedtimer="a"
  last_barcolor="54143"
  last_htmlbgcolor="white"
endif


;-----------------------------------------------
; handle special commands
;-----------------------------------------------
if ((newnote=="h") | (newnote=="hold") || (newnote=="stop") || (newnote=="suspend")) do
  *Timer Stop abdz
  cl.SetBackColor ("timer_track", 0, 16744576)            
  quit

elseif ((newnote=="s") | (newnote=="start") || (newnote=="resume") || (newnote=="continue") || (newnote=="cont")) do
  *Timer Start last_usedtimer
  *Timer Start "d"
  cl.SetBackColor ("timer_track", 0, last_barcolor)            
  cl.SetBackColor ("timer_track", 1, last_barcolor)            
  cl.SetBackColor ("timer_track", 2, last_barcolor)            
  quit

elseif ((newnote=="r") | (newnote=="reset"))do
  *Timer Clear abdz
  quit

elseif ((newnote=="") | (length(newnote) < 2)) do
  quit

elseif (newnote=="arrival") do
  *Timer Clear abdz
  last_htmlbgcolor="BLANCH-DALMOND"      
  newnote="b arrival"
endif


;-----------------------------------------------
; set new displayed note to be the entered text
; type:
;    (m)ain, (w) - work but not main, (z/p) private
;-----------------------------------------------
note=newnote
notetype="m"

;-----------------------------------------------
; handle private tasks
;-----------------------------------------------
if ((index(note,"z ")==1) || (index(note,"p ")==1)) do
  notetype=word (note, 1)
  last_usedtimer="z"
  last_barcolor="8421631"
  last_htmlbgcolor="red"
  *Timer Stop abdz
  *Timer Start z
;;  *Format Item item 1 list "timer_track" text "*Info timersec a"

;-----------------------------------------------
; handle tasks that are related to work but not main work tasks
;-----------------------------------------------
elseif (index(note,"w ")==1) do
  notetype=word (note, 1)
  last_usedtimer="b"
  last_barcolor="8454143"
  last_htmlbgcolor="yellow"
  *Timer Stop abdz
  *Timer Start b

;-----------------------------------------------
; handle tasks that are related to real code
;-----------------------------------------------
;elseif (index(note,"c ")==1) do
;  notetype=word (note, 1)
;  last_usedtimer="a"
;  last_barcolor="54143"
;  last_htmlbgcolor="white"
;  *Timer Stop abdz
;  *Timer Start a


;-----------------------------------------------
; handle main work tasks
;-----------------------------------------------
else
  notetype="m"
  last_usedtimer="a"
  last_barcolor="54143"
  last_htmlbgcolor="white"
  *Timer Stop abdz
  *Timer Start a
  
  if (index(note,"l ")==1) do 
  note = alias_l ++ note
  elseif (index(note,"sr ")==1) do 
  note = alias_sr ++ note
  elseif (index(note,"m ")==1) do 
  note = alias_m ++ note
  endif
endif


;-----------------------------------------------
; set color of bar
;-----------------------------------------------
cl.SetBackColor ("timer_track", 0, last_barcolor)
cl.SetBackColor ("timer_track", 1, last_barcolor)
;cl.SetBackColor ("timer_track", 2, last_barcolor)
;cl.SetBackColor ("timer_track", 3, last_barcolor)


;-----------------------------------------------
; if user entered 'home', close HTML table and create
; new HTML table
;-----------------------------------------------
if (newnote=="home") do
  *Timer Stop abdz
  cl.SetBackColor ("timer_track", 0, 16744576)            
  last_htmlbgcolor="orange"

  ; calculate main work time
  plannedHours = timer("a")/3600
  plannedMin   = (timer("a")%3600)/60
  plannedTime  = ""++plannedHours++":"++plannedMin

  ; calculate work related tasks
  noplannedHours = timer("b")/3600
  noplannedMin   = (timer("b")%3600)/60
  noplannedTime  = ""++noplannedHours++":"++noplannedMin

  ; calculate private tasks
  privateHours = timer("z")/3600
  privateMin   = (timer("z")%3600)/60
  privateTime  = ""++privateHours++":"++privateMin

  ; create the text for the report
  ; note="Planned:"++plannedTime++"  Not planned:"++noplannedTime++"  Private:"++privateTime
endif


;-----------------------------------------------
; caluclate task duration and reset the duration timer
;-----------------------------------------------
deltaTimeHours = timer("d")/3600
deltaTimeMin   = (timer("d")%3600)/60
deltaTime  = ""++deltaTimeHours++":"++deltaTimeMin
*Timer Clear d
if (newnote!="home") do
    *Timer Start d
endif

;-----------------------------------------------
; update the log file (html report)
;-----------------------------------------------
;FOR CSV file: s = formatdate("dd/MM/yyyy",date)++","++formattime("HH:mm",time)++","++notetype++","++note
s = formatdate("dd/MM/yyyy",date)++" "++formattime("HH:mm",time)++" ["++notetype++"] "++note

fh = file.open(log_file,"a")
fh.writeLine(s)
fh.close


Comments

You make some great points and I don't think I could have made them any better. Thanks for the good information !
Ziv said…
Thanks
Anonymous said…
Thank you, as a fellow PowerPro user this is an interesting script. However, I note that it references the timer_track and taskbar bars, which are not defined. Would you be able to give some more information on what they are or they contain in terms of buttons or menus?

Popular posts from this blog

Best freeware - XML editor

As a software developer, I open XML files all the time. I a heavy commercial XML editor. But nothing can compare to a small, thin and free XML editor like 'foxe'. A great feature is has is the alignment of long XML strings to readable XML format (Shift-F8). It help lot of times when the XML file was generated by some tool and was not readable. Homepage: http://www.firstobject.com/dn_editor.htm

Jenkins error: groovy.lang.MissingPropertyException

I tried to run groovy build step and got below error. This post will describe how I solved the problem. Caught: groovy.lang.MissingPropertyException: No such property: hudson for class: script

SSL in pictures

Here is my summary on SSL (or as I like to call it 'SSL for dummies')