My outboard memory

You might think that the best part of posting my scripts here is the international adulation. Or the untold wealth. But no, the best part is that it gives me a single place to search for scripts that I’ve written but can’t remember the name of.

Two days ago, for instance, I was writing a short AppleScript and I needed to open up the Finder’s AppleScript dictionary to check the syntax of a particular command. I hit ⇧⌘O and was presented with this:

Doubled AppleScript dictionaries

Scrolling down, I found that every application in the list was doubled. I remembered that this happens for the same reason that the Open With context menu sometimes gets filled with multiples. I also remembered that I’d found several web sites with the solution to this problem and that I’d written a script that used that solution. What I couldn’t remember was what I’d called the script.

No matter. I opened a new Safari tab and typed

open with ;lean

into the omnibar. The last bit is a TextExpander snippet I use for running Google searches on my site. TextExpander expanded the field to

open with

and performed the search.1 The top hit was a link to this page, which told me that my solution was actually an alias defined in my .bashrc file, not a freestanding script, and that it was named fixopenwith. Running that command and following it up with killall Finder fixed the problem in both the AppleScript dictionary list and the Open With menu.

Programming books always tell you to include good comments in your code so you can figure out what you were doing when you return to it months or years later. I’ve gone beyond that level of forgetfulness and need crutches like this just to find my old scripts.

  1. I highly recommend you make similar snippets if you find yourself searching particular sites often. I have another one for YouTube, for example.