How do I get an apps process time?

This works as a stand alone script:


on get_ProcessTime(proc)
		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?

Nevermind, i got it

ok man cool

I mean, why not share more details about your problem and solution? Maybe someone else will have a similar problem in the future and will benefit from the knowledge.