I am creating an applescript that should wait for two processes to finish and then execute some logic. The first is an Application, which is easy to wait for.
set program to "Applications/xyz.app"
repeat until (application program is not running)
pgrep to look for the process id of a process called
aria2 like this:
do shell script "/usr/bin/pgrep aria2"
I don't have
aria2 so I am only guessing its process name - try it in the Terminal first to see if it works:
There will be no output if it is not running.
To see fuller output, run:
ps -aef | grep -i aria
If you want to check it in a loop, you could do this sort of thing:
set ariarunning to 0 repeat until ariarunning > 0 try set ariarunning to do shell script "/usr/bin/pgrep aria" end try end repeat