Skip to content

Instantly share code, notes, and snippets.

@roxlu
Created April 29, 2012 09:36
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roxlu/2549033 to your computer and use it in GitHub Desktop.
Save roxlu/2549033 to your computer and use it in GitHub Desktop.
Keep application running, auto restart on crash
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning
on makeActive(appName)
tell application appName
activate
end tell
end makeActive
repeat
if appIsRunning("emptyExampleDebug") then
else
do shell script "open -a /Users/diederick/Documents/programming/c++/of/app/projects/peepee/game/bin/appdebug.app/Contents/MacOS/appDebug"
end if
makeActive("appDebug")
delay 25
end repeat
@lab101
Copy link

lab101 commented May 9, 2012

The windows version:

:begin
start /WAIT emptyExample.exe
timeout /T 10
Goto begin

add this into the registry to avoid crash messagebox

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting]

"ForceQueue"=dword:00000001

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\Consent]

"DefaultConsent"=dword:00000001

@roxlu
Copy link
Author

roxlu commented May 9, 2012

Thanks Kris! Nice to keep track of these here :>

@lab101
Copy link

lab101 commented Jun 18, 2012

For people (like myself) who are more confident with bash script

!/bin/bash

while true
do

using open to get focus

open -a empltyExample
sleep 10
done

Change the default program for scripts to terminal if you want to use it with autostart

@vormplus
Copy link

Or you could use Lingon on Mac OS X. It basically puts an xml file with the right settings in ~/Library/LaunchAgents

http://www.peterborgapps.com/lingon/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment