Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Lokrado

macrumors regular
Original poster
I need an AppleScript that will continousley check if a specific process is running, then initiate something once this process is running. I tried about a hundred different things but nothing will work
 
Try this:

Code:
processCheck()
on processCheck()
	tell application "System Events" to get name of every process
	if the result contains "Finder" then
		beep --put your actions here
		
	else
		processCheck()
	end if
end processCheck

Just replace Finder with the process you want and beep with the action you want it to run. Be careful, this script can run away sometimes.
 
That works, but this is simpler:

Code:
repeat until application "Safari" is running
	delay 1
end repeat
-- do something once it's running
 
That works, but this is simpler:

Code:
repeat until application "Safari" is running
	delay 1
end repeat
-- do something once it's running

This doesn't work as it's not a GUI app I'm working with but rather a terminal utility, that's why I wrote process 😀
 
Try this:

Code:
processCheck()
on processCheck()
	tell application "System Events" to get name of every process
	if the result contains "Finder" then
		beep --put your actions here
		
	else
		processCheck()
	end if
end processCheck

Just replace Finder with the process you want and beep with the action you want it to run. Be careful, this script can run away sometimes.

This one doesn't work either..
Got a bunch of funny errors encluding overflow, once I got rid of those it just seems to run for infinity without doing anything
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.