Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there easy way to ensure that some gui application is running (restart if it crashes)?

share|improve this question
add comment

3 Answers

up vote 1 down vote accepted

Check out the script in msg 20 in this thread and modify it to the application you are interested in keeping alive.

It will help you create a Launch Agent to check and open when necessary.

This alleviates the need for an Applescript application running.

http://hintsforums.macworld.com/showthread.php?t=114422

share|improve this answer
    
Awesome!!!!!!!! –  tig Nov 4 '10 at 3:12
add comment

Yes, you can do what you need with AppleScript.

First, Open AppleScript Editor (/Applications/Utilities/AppleScript Editor.app)

Then insert this code into the editor:

tell application "System Events"
    repeat
        set running_apps to every application process's name
        if running_apps does not contain "TextEdit" then
            tell application "TextEdit" to activate
        end if
    end repeat
 end tell

Replace TextEdit with the application you want to watch. Then save this as an application and run the application you saved whenever you need to keep the application open.

Hope this helps!

share|improve this answer
add comment

Applescript might be the way to go with this one. This webpage outlines how to see if an application is running and this webpage outlines how to run an application and also how to perform an action based on criteria. Basically you would script it so that you loop a check to see if the app is running. If at any time it is not running, you start it. I'd draft out something for you but at this time I don't have a working Mac to test with.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.