01/31/13 11:58:12

Limit Time Spent With Certain Activities Using Keyboard Maestro

Say you want to control how much time you spend with a thing. Maybe you also want to tie this activity to a certain limitation; like when a total amount is reached, you are not allowed to continue. Wouldn’t it be nice to have something that would help you do that?

Well, Keyboard Maestro to the rescue!

I wrote this a long time ago and thought it’s worth sharing. This “Timers” group contains three macros.

Timer Start

Timer Start sets a variable to the current time. You would add an app launch trigger if you want to limit your usage of YoruFukurou or you would trigger this by script. If you want to limit your usage of twitter.com, simply create a new macro that always fires when you switch to your browser (application trigger), then execute an AppleScript that checks whether the browser tabs contains certain keywords or domains, if yes, then execute the Timer Start macro. This is not included in this example.

Timer Stop

This macro triggers when you “leave” your activity. So when you switch away from YoruFukurou or your frontmost browser tab, etc. This macro checks the amount you’ve set in the next macro and subtracts how much time has passed since you’ve started your activity. It will then go ahead and display a notification. In case you create your own customized version that always triggers when you switch away from an app, you might want to delete the notification for your own sanity.
To customize this macro, simply add your “consequence” actions here. “Quit YoruFukurou if there is no time left”, “close a tab”, etc.

The only downside here is that the way these macros are laid out, they don’t check constantly whether you’ve exceeded the total amount. You can see it as feature, you’re allowed to stay in your activity as long as you don’t quit it. This will teach you a lesson about Twitter, I’m sure.

Timer Reset

Timer Reset finally resets your total amount of time for the activity, assuming that every day you will get the same amount of time for it. You probably don’t want to punish yourself not using Twitter longer and longer a day after you spent too much time on it. I certainly don’t.

Hint Hint

This is just an example and contains only the counters, but this article should give you an inspiration what you can do with it.

As a hint: check out the If Then Else action. There’s a lot you can do here. Check for a certain network name and turn off AirPort if you spent too much time on the Internet? No problem.

Available as one file download or separately in the Keyboard Maestro repository.