So, I’m trying to come up with some ideas for some “features” or post categories, like the previous “Dinner Tonight” (which I realized within the past few days was blatantly ripped off from Cooking Light). I feel like this will help me to execute ideas well, and to keep things interesting.
So, for the inaugural Quick Hack, we have something I put together in the past couple of days. I just started TAing for a class at University of Washington in the DXARTS department, which I called home for the last 3.5 years. The class is one that I took in the spring of 2006, called DXARTS 460: Digital Sound. The class covers basics of the history of electronic music, some basic editing/mixing/synthesis techniques, and basically prepares students for diving into the year-long audio course offered by the department.
Anyhow, I’m now gainfully employed for the next few weeks, and with employment comes timecards. I knew I was going to be spending time out of class actually working (both office hours and grading), so I wanted to come up with a good way of easily tracking my time that would be relatively painless and of course, very slick. Enter Clockr (silly name I know, especially for how ridiculously simple the app is).
Now, another quick tangent! One of my goals for this summer was to learn a few more programming languages in order to expand my computer science repertoire. I settled on some type of C and Cocoa, since both go relatively hand in hand, and I have an inkling to write an iPhone app. More on that later. Now, I already know a fair amount of AppleScript, so I set about writing my little hack with that. In my google searches for various code snippets, or for apps people had written before, I came across a tutorial for using checkboxes with AppleScript. Apparently, there’s not any way you can just hack them together using AppleScript alone. You need to get Xcode involved. So, I followed the tutorial, which basically has you build up a GUI in Interface Builder first.
Everyone loves HUD windows (right?), so I went with that, made some checkboxes and a big pushbutton. The rest of the magic all happened in AppleScript. All I had to do was give the checkboxes and button some names that I could reference, then write out the script itself.
So basically, what you do see in this script is the check for which checkbox is selected, and some built in sexiness using Growl. If you use a Mac and you’ve never seen or tried Growl, you definitely need to. Not only does it look incredibly sexy, but it really becomes a vital part of your user experience when you are doing stuff on your computer. Anyhow, what you DON’T see happening is actually the whole point of the app. At the end of the script, it grabs the current date, then prepends the date string with “CLOCK IN:” or “CLOCK OUT:” (depending on what checkbox is selected), and writes it to a text file.
I just started using the application today, so there’s not much there yet, but at the end of the current pay period, I’ll be able to go right in and easily add up all of my time fairly accurately. And if I do happen to mess something up, or forget to clock in, I can always go and edit it by hand as it’s just a text file.
It might seem like a lot of work for something as simple as writing down clock hours, but it was more about fiddling with Xcode and flexing my AppleScript muscles a little bit more. I’m excited to start working more with Cocoa, in hopes of developing more useful and practical applications.








