Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Automate an Internet content filter' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Automate an Internet content filter
Authored by: gdelfino on Aug 08, '10 08:53:06PM

For me, what I have found to work is to automatically generate anti-distractions recurrently.

Let me explain. Suppose that I need to get some work done using a set of applications, for example: TextMate, Skim, Mathematica, Finder, Illustrator and Photoshop. And my distractions come from the other applications (Safari, etc..)

This AppleScript will detect when you are using a distracting application every 2 minutes. And it will remind you get back to work, if you fail to swhtch your app after two reminders it activates your default work apps effectively interrupting your distraction.


tell application "GrowlHelperApp"
	set the allNotificationsList to {"Work Reminder"}
	
	set the enabledNotificationsList to {"Work Reminder"}
	
	register as application "GD Work Reminders" all notifications allNotificationsList default notifications enabledNotificationsList
	
	set cycles_lost to 0
	
	repeat
		delay 120
		set app_name to the name of (info for (path to frontmost application))
		set real_work_apps to {"TexShop.app", "Skim.app", "Textmate.app", "Finder.app", "Mathematica.app", "Adobe Illustrator.app", "Adobe Photoshop CS3.app"}
		if (real_work_apps does not contain app_name) then
			notify with name "Work Reminder" title "Get back to work" description "Remember to work on whatever need to do. " & app_name application name "GD Work Reminders" image from location "file:///Users/gdelfino/Pictures/Look_a_Distraction_Design_by_eecomics.jpg"
			set cycles_lost to cycles_lost + 1
		else
			set cycles_lost to 0
		end if
		if cycles_lost > 2 then
			tell application "TextMate" to activate
			tell application "Skim" to activate
		end if
	end repeat
end tell


[ Reply to This | # ]