As an adult with ADD, I'm a huge fan of Steve Lambert's SelfControl. This nifty app, for those who don't know, is a great boon to the Internet addict and to easily distractible folks such as myself. It is a timed Internet filter that can block sites based on a whitelist or blacklist. Once you turn it on, it's virtually impossible to deactivate until its timer runs out. So, if I wanted to work on a project for 3 hours without checking Twitter or Facebook, I would simply add facebook.com and twitter.com to SelfControl's list of blocked sites, set its timer for 3 hours, and get some real work done.
I find it helpful to be able to automate this app, so that I don't change my mind and decide to blow off work at the beginning of the day. To this end I have an AppleScript scheduled to activate SelfControl every weekday morning while I'm still sleeping, which lasts until mid-day, so I can get stuff done when I wake up, rather than just roll out of bed onto Facebook.
Prerequisites:
on run argv set defaultTime to 1 try set myTime to item 1 of argv as number on error set myTime to defaultTime end try tell application "Usable Keychain Scripting" tell current keychain set myPass to (password of first generic item ¬ whose name contains "SelfControl") -- eliminate invisible characters, or "gremlins," from password set x to quoted form of myPass set myPass to do shell script "echo " & x & " | perl -pe 's/[^[:print:]]//g'" end tell end tell tell application "SelfControl" to activate tell application "System Events" tell process "SelfControl" tell slider of window "SelfControl" to set value to myTime click button "Start" of window "SelfControl" end tell tell window 1 of process "SecurityAgent" with timeout of 15 seconds repeat set tryAgain to false try set value of text field 2 of scroll area 1 of group 1 to myPass on error delay 1 set tryAgain to true end try if not tryAgain then exit repeat end repeat click button 2 of group 2 end timeout end tell end tell end run
Mac OS X Hints
http://hints.macworld.com/article.php?story=20100801214648362