Hi,
I had a script that could get the current non-background processes, but lost it. It used unix ‘ps’ and was very efficient… I can’t remember the flags and read the man pages but it eludes me.
Thanks,
Kel.
Hi,
I had a script that could get the current non-background processes, but lost it. It used unix ‘ps’ and was very efficient… I can’t remember the flags and read the man pages but it eludes me.
Thanks,
Kel.
Hmm… not sure here, the “best” output I could get from ps was this:
Obviously, this still includes some background processes. But what about some vanilla AppleScript?
on getProcesses()
tell application "System Events"
set procs to get processes where visible = true
set proclist to {}
repeat with proc in procs
set end of proclist to (name of proc)
end repeat
end tell
return proclist
end getProcesses
Regards,
danB
Model: iBook g3/800 14"
Browser: Safari 312.3.3
Operating System: Mac OS X (10.3.9)
We can eliminate the control loop if we wish:
tell application "System Events"
set yourVariableHere to (name of every process whose visible = true)
end tell
It was something like that, but just the list of process names. Something like:
do shell script “ps -cx command”
and another flag to take out the column labels. I must have read the man pages about 10 times this time and still can’t get it.
I know how to do the AppleScript way, but the ps gets app processes that soemtimes aren’t listed.
Thanks a lot,
Think I got it. Sonething like this:
set ps_out to do shell script “ps -cxo command”
set ps_list to paragraphs 2 through -1 of ps_out
Now how to get rid of the system processes?
Hi kel. Have you considered something like this?
tell application "System Events" to name of processes whose background only is false