Skip to content

Instantly share code, notes, and snippets.

@kacy
Created May 22, 2010 19:38
Show Gist options
  • Save kacy/410304 to your computer and use it in GitHub Desktop.
Save kacy/410304 to your computer and use it in GitHub Desktop.
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