Created
January 24, 2012 23:11
-
-
Save roxlu/1673389 to your computer and use it in GitHub Desktop.
Applescript which makes sure an application keeps running, with options to activate/hide the app.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on appIsRunning(appName) | |
| tell application "System Events" to (name of processes) contains appName | |
| end appIsRunning | |
| on hideDock() | |
| tell application "System Events" | |
| keystroke "d" using [command down, option down] | |
| end tell | |
| end hideDock | |
| on hideApp(appName) | |
| tell application "Finder" | |
| set visible of process appName to false | |
| end tell | |
| end hideApp | |
| on showApp(appName) | |
| tell application "Finder" | |
| set visible of process appName to true | |
| end tell | |
| end showApp | |
| on makeActive(appName) | |
| tell application appName | |
| activate | |
| end tell | |
| end onMakeActive | |
| repeat | |
| if appIsRunning("ApplicationName") then | |
| makeActive("ApplicationName") | |
| else | |
| do shell script "open -a /path/to/ApplicationName.app" | |
| end if | |
| delay 10 | |
| end repeat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment