andrew burke





Nifty OS X Finder Enhancement With Little AppleScripts

Posted on: 2007-02-15

I know AppleScript is supposed to be able to do all sorts of cool stuff. However, it's always struck me as sort of a reverse of Perl: easy to read but difficult to write. It's full of 'helpful' syntax that ends up getting in the way if you've already programmed before. However, it is an under-appreciated tool that lets you do some pretty cool things in OS X.

One of the features I use a lot in the Finder is 'Clean Up', which rearranges all of the icons in a window into a nice grid. I also like to sort the icons by date, size, name, etc. Windows and older Mac OSes used to have these options in a right-click menu or just in the toolbar on the finder window. Now, these are only accessible through the View menu at the top of the screen. I guess they decided that if you wanted things sorted by name/date/etc. you could use one of the other file listing formats - which is true, but sometimes I like the icons.

I was reading a blog post on Oreilly that mentioned that you could add applications and files to the Finder window toolbar. I tried dragging an app over there and it showed up and was clickable. That's neat, I thought. Then a light bulb turned on in my head.

So, I went into the Script Editor and built a set of little scripts that look like this:

tell application "Finder"
   clean up Finder window 1 
end tell

The last line in each file was 'clean up Finder window 1 by name | modification date | creation date | physical size' depending on what I wanted to do. I then dragged the script files to my finder toolbar and now I can reorganize my icons with a simple click.

I could probably do something even more slick with Folder Actions, or at least I could redesign the icons to look more like what they're supposed to do. But it's a small itch and it only really needs a small scratch.

Previous: Toronto DemoCamp 12
Next: Life Tip: Digitize Your Documents