Pages

Thursday, August 8, 2013

Applescript/Terminal: Get PIDs of processes starting with...

Hello,

 

Is there a way to return all the PIDs of processes starting with "Myapp_action_download" in a neat array in Applescript, so I can kill them using Terminal?

 

Something like this:

 

set openapps to {}

set openapps to (do shell script "the shell script which I don't know")

--This script gets all the PIDs of processes starting with "Myapp_action_download", and returns them in a neat array

set appcount to 0

 

repeat (count of items of openapps)

set appcount to appcount + 1

do shell script ("kill -9 " & (item appcount of openapps) as text)

end repeat

 

Kind regards,

 

Isaiah


View the original article here

0 comments:

Post a Comment