This works as a stand alone script:
get_ProcessTime("iTunes")
on get_ProcessTime(proc)
try
tell application "System Events" to set pid to the unix id of process proc as Unicode text
return paragraph 2 of (do shell script "ps -p " & quoted form of pid & " | awk '{ print $4 }'")
on error
return "0"
end try
end get_ProcessTime
but it won’t work when I add it to my other code. Does anyone know why?