Hi Everybody
I cant seem to figure out where i am going wrong.
What i want to do is call a shell script that will return the CPU usage of Final Cut Pro.
So far i have the shell script which seems to work.
ps -Au | grep Final | grep app | awk ‘{print $3}’
Yet when i try ad run it it applescript everything seems to fall apart.
set blob to (do shell script "ps -Au | grep Final | grep app | awk '{print $3}'")
display dialog blob
The only bit that seems to be working is the “ps -Au”. When i try “ps -Au | grep Final” . Please if anybody could help it would be much appreciated.
many thanks
michael
Hi Michael,
try this:
set blob to word 3 of (do shell script "ps -Auc | grep Final")
Edit: Good points Mark. I’ve edited my post to include them.
do shell script "/bin/ps -wAco '%cpu','command' | /usr/bin/grep Safari | /usr/bin/grep -v grep | /usr/bin/awk '{print $1}'"
The Main reason you get no results in AS is the result needs to be in effect wrapped using the -w option.
Also its a good idea to cancel out the grep process from the results using the -v option
set blob to (do shell script "ps -Auw | grep Final | grep -v grep | grep app | awk '{print $3}'")
display dialog blob
Thank you all for your help.
The reason i added the “grep app” was to get rid of grep from the results.
thank you again
michael