Last active
August 29, 2015 14:27
-
-
Save ohnx/0889adce658f8a50a55f to your computer and use it in GitHub Desktop.
prevent apps from opening
This file contains 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
#!/bin/bash | |
while true; do | |
#Office Apps | |
osascript -e 'tell application "System Events" to keystroke "q" using command down' & | |
var=$((`killall -v "Microsoft Word" | wc -l` + `killall -v "Microsoft PowerPoint" | wc -l` + `killall -v "Keynote" | wc -l` + `killall -v "Pages" | wc -l` + `killall -v "Numbers" | wc -l`)) | |
#Misc Apps | |
var+=$((`killall -v iBooks | wc -l` + 0)) | |
var+=$((`killall -v GarageBand | wc -l` + 0)) | |
var+=$((`killall -v "App Store" | wc -l` + 0)) | |
var+=$((`killall -v "iTunes" | wc -l` + 0)) | |
var+=$((`killall -v "Java" | wc -l` + 0)) | |
#Other | |
var+=$((`killall -v "Activity Monitor" | wc -l` + 0)) | |
#var+=$((`killall -v "Finder" | wc -l` + 0)) | |
var+=$((`killall -v "Terminal" | wc -l` + 0)) | |
var+=$((`killall -v "System Preferences" | wc -l` + 0)) | |
#Web Browsing | |
var+=$((`killall -v "Safari" | wc -l` + 0)) | |
var+=$((`killall -v "Google Chrome" | wc -l` + 0)) | |
var+=$((`killall -v "Firefox" | wc -l` + 0)) | |
#Other 2 | |
var+=$((`killall -v "Mail" | wc -l` + 0)) | |
var+=$((`killall -v "Contacts" | wc -l` + 0)) | |
var+=$((`killall -v "Notes" | wc -l` + 0)) | |
var+=$((`killall -v "Maps" | wc -l` + 0)) | |
var+=$((`killall -v "Messages" | wc -l` + 0)) | |
var+=$((`killall -v "FaceTime" | wc -l` + 0)) | |
var+=$((`killall -v "Photo Booth" | wc -l` + 0)) | |
var+=$((`killall -v "iPhoto" | wc -l` + 0)) | |
var+=$((`killall -v "Notes" | wc -l` + 0)) | |
#Block text editors | |
var+=$((`killall -v "TextEdit" | wc -l` + 0)) | |
var+=$((`killall -v "TextWrangler" | wc -l` + 0)) | |
osascript -e 'tell application "System Events" to keystroke "q" using command down' & | |
if [ $var -gt 0 ]; then | |
osascript -e 'tell app "System Events" to display dialog "Nope.avi"' & | |
fi | |
done | |
# cd /Applications; find *.app -d | grep \w*.app$ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment