how do I use indigo to make sure that a certain .app is running in the background, and if not start it (i know that one)
thx
Karl
set pgmToFind to "xxxxx"
set theResponse to " "
try
set theResponse to do shell script "ps aux | grep '" & pgmToFind & "' | awk '{print $2}' "
end try
-- if xxxxx is running then theResponse has 3 lines with 1 PID from : ps, xxxx itself and one more --- have not figured out which one..
set noOfWords to count words of theResponse
if noOfWords < 3 then -- if not running start script:
do shell script "open '/Library/Application Support/Perceptive Automation/Indigo 6/Scripts/Background Tasks/"&pgmToFind&".app' "
end if
return true
tell application "System Events"
set itsRunning to false
set runningApps to the name of every process
repeat with thisApp in runningApps
if text of thisApp is "<name of app as seen in the Finder>" then
set itsRunning to true
end if
end repeat
if itsRunning is false then
-- Do things here if the app isn't running.
end if
end tell
Users browsing this forum: No registered users and 1 guest