Sliced Software

Sliced Software strives to produce high quality, easy to use software.

Software

PGnJ An intuitive Database Development Environment for Mac OS X.

Seymore Content management, made easy.

Argus Issue tracking for the rest of us.

@twitter

I Love Camino!

This post is not yet over at tumblr! But it will be soon.
July 14

Red Sweater’s FlexTime


When Daniel over at Red Sweater posted about FlexTime the other day, I immediately thought about automating something for the code for 50 minutes - break for 10 minutes thing I always read about on productivity sites but have never tried. Of course, he already thought of that and included a sample routine for this purpose.

I decided that it might be neat to have it run an AppleScript that would essentially toggle between two environments: coding and break time. I wasn't sure how useful it would be, but I've never written any AppleScript and thought it might be worthwhile, at least for that.

Quick & Dirty
-----------------
The setup has two AppleScripts: start-break and start-coding, two todo text files: break.todo and coding.todo, two Automator apps: break.todo.app and coding.todo.app and of course the FlexTime routine.

Let's start with the start-coding AppleScript:

say "time to start coding"

tell application "Adium"
	set my status type to away
	set my status message to "coding"
end tell

tell application "System Events"
	(*hide Adium*)
	set this_app to some item of (get processes whose name = "Adium")
	set visible of this_app to false

	(*hide NetNewsWire*)
	set this_app to some item of (get processes whose name = "NetNewsWire")
	set visible of this_app to false

	(*show Terminal*)
	set this_app to some item of (get processes whose name = "Terminal")
	set visible of this_app to true

	(*show Camino*)
	set this_app to some item of (get processes whose name = "Camino")
	set visible of this_app to true

	(*show Eclipse*)
	set this_app to some item of (get processes whose name = "java")
	set visible of this_app to true
end tell

(*execute automator app that opens coding.todo file in TextMate*)
tell application "coding.todo.markdown"
	activate
end tell
Again, I've never written any AppleScript so I sort of just threw this together. I assume there are ways to ensure the application you are trying to toggle visibility is actually running that would safe guard this script from dying a horrible death, but that wasn't really the point of this.

Okay, so the AppleScript is pretty straight forward I think. Set my status in Adium to away and my away message to say that I'm coding, hide Adium and NetNewsWire, show Terminal, Camino and Eclipse. Oh, by the way, I write J2EE software, so I live in those three applications. The last bit there that starts the coding.todo.markdown application is starting an Automator application I setup that would open my coding.todo.markdown text file in [TextMate](http://www.macromates.com/). The other script, start-break, is the reciprocal of this one.

The idea behind the coding.todo and the break.todo I had was that you could use Quicksilver to append something to the todo that you aren't using right now. For example, when you're programming, something may pop into your head that is completely unrelated. Normally you may fire up your browser and go investigate this more, but this way you could just quickly 'jot' the idea down and on your next break, your text file of all of your break-oriented ideas would be there for you.

I was also thinking that it would be neat to have an AppleScript that could interrogate FlexTime to see if you are currently on a break or writing code, then append whatever you wrote to the opposite todo file. I'm not sure if FlexTime will support anything like this or not though.

The Right Way
-------------
After I threw this overly-complicated process together, I thought of a much better approach. Run some virtual desktop application and simply switch between a coding desktop and a non-coding desktop. I haven't looked into it, but I assume there is some way to change virtual desktops from an AppleScript with one of those applications. This would be a lot more elegant. You could easily switch back to the opposite desktop if you were in the middle of something and need to stretch your coding or break time a bit more. This would also allow you to have any applications open and not have them hard coded in your scripts.

The original approach is pretty lame and I think it might be more of a hassle than a help, but implementing this idea with the help of some virtual desktop software may actually have some positive affect on your workload. Anyway, just a thought.