This is what I have. And it works, but it gives me a list that is all over the place. And some process such as iChat have 2 pid’s and this messes up the layout. I want something that returns a nice list in the display dialog like
‘PID’ - ‘App Name’
‘PID’ - ‘App Name’
‘PID’ - ‘App Name’
‘PID’ - ‘App Name’
‘PID’ - ‘App Name’
‘PID’ - ‘App Name’
set theProcess to ""
set listProcess to ""
tell application "System Events" to set psNames to get name of every process whose background only is false
repeat with i from 1 to count of psNames
set theProcess to (item i of psNames as text)
set the_pid to (do shell script "ps ax | grep " & (quoted form of theProcess) & " | grep -v grep | awk '{print $1}'")
set listProcess to the_pid & " - " & (item i of psNames as text) & "
" & listProcess
end repeat
display dialog listProcess
I imagine that i’m pretty close to what I need… Just off a little bit.