Created
May 22, 2010 19:38
-
-
Save kacy/410304 to your computer and use it in GitHub Desktop.
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
global currentCount | |
global allNotificationsList | |
global enabledNotificationsList | |
global badAppsList | |
set currentCount to 0 | |
set the allNotificationsList to {"running", "quitting"} | |
set the enabledNotificationsList to {"running", "quitting"} | |
# This is where you would add the blacklisted applications that | |
# keep you from being productive. | |
set the badAppsList to {"Echofon", "NetNewsWire", "Tweetie"} | |
tell application "GrowlHelperApp" | |
register as application "Procrastinapp" all notifications allNotificationsList default notifications enabledNotificationsList icon of application "AppleScript Editor" | |
end tell | |
on isRunning(appName) | |
tell application "System Events" | |
set allApps to (get name of every application process) | |
if allApps contains appName then | |
tell application "GrowlHelperApp" | |
notify with name "running" title "Bro, seriously???" description appName & " is running. You should be doing your freakin' work. Get on that junk man!" application name "Procrastinapp" | |
end tell | |
set currentCount to currentCount + 1 | |
end if | |
end tell | |
end isRunning | |
on idle | |
if (currentCount) is greater than 2 then | |
tell application "GrowlHelperApp" | |
notify with name "quitting" title "Told you so..." description "We closed the app because you should have." application name "Procrastinapp" | |
end tell | |
repeat with i in badAppsList | |
tell application i to quit | |
delay 1 | |
end repeat | |
set currentCount to 0 | |
end if | |
repeat with i in badAppsList | |
isRunning(i) | |
end repeat | |
end idle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment