Improved ‘Find’ command shortcut for iTunes (and Address Book)

Posted by Pierre Igot in: iTunes, Macintosh
June 2nd, 2010 • 2:58 pm

Yesterday, I wrote a post about using Keyboard Maestro to assign command-F as a shortcut for selecting iTunes’s search field in the toolbar.

As I noted in my update after receiving e-mail feedback from several readers, it turns out that there is a built-in shortcut for selecting the search field in iTunes, which is only documented in iTunes’s help feature: command-option-F can be used to select the search field in iTunes.

(The same shortcut is used in Safari for selecting the Google search field, which is in the same location in the toolbar in Safari. Just like with iTunes, I didn’t know about this shortcut and for many years have been using command-L followed by Tab to select the location field and then move to the next field, i.e. the Google search field.)

While the existence of this built-in shortcut is good news, I still believe that it can be useful to design a customized command shortcut for searching the iTunes library using Keyboard Maestro.

With Keyboard Maestro, not only is it possible to assign the more obvious and easier-to-type shortcut command-F to a macro for selecting the search field, but, as a reader also suggested, before selecting the search field, you can use Keyboard Maestro actions to force iTunes to select the main library in the sidebar first.

This is useful if, like me, you often select individual playlists or folders in the sidebar and leave iTunes in that state. When I return to iTunes later to initiate a search for a track, I don’t always remember to first go back up to the top of the list in the sidebar and select my main library. If I don’t remember to do this, when I type a search request in the search field, the search applies to the currently selected playlist or folder and not to my entire library.

When that happens, I then have to scroll back up to the top of the list in the sidebar, select my main library, select the search field again, and retype my search request. It’s rather painful.

With Keyboard Maestro, I can now design a macro that:

  1. simulates a mouse click somewhere inside the sidebar to bring the focus on the sidebar (I use the coordinates [72,100] relative to the top left corner of the front window)
  2. simulates the Page Up keystroke 4 times, which is enough in my case to scroll all the way back up to the top of the list, even if I have several expanded folders
  3. simulates another mouse click at [72, 100] relative to the top left corner of the front window, which selects the main music library icon
  4. simulates a mouse click at [-50,41] relative to the top right corner of the front window, which selects the search field
  5. simulates the command-A keystroke, which selects the contents of the search field if there is anything already there

After I assign the command-F hot key to this macro in iTunes, I now have a very easy-to-use keyboard shortcut for selecting the search field and ensuring that the search will span my entire music library and not the currently selected playlist or folder in the sidebar.

Of course, in cases where I actually want to limit my search to a specific playlist/folder (which is rather unlikely), I can always use the mouse or the built-in command-option-F shortcut.

In closing, I should note that a similar approach can be used for Mac OS X’s Address Book application. I very frequently find myself having to retype the same search request twice in Address Book, because the first time I forgot to first select “All Contacts” in the leftmost column and so Address Book restricts the search to the group of contacts that is currently selected in that column.

The macro I use in Address Book is exactly the same as the one above, except that the coordinates for clicking on “All Contacts” in the leftmost column (step 3) are (72,75).

And I can assign the command-F hot key to that macro in Address Book, so that it bypasses the default “Find” command in the “Edit” menu, which, unlike my macro, fails to select “All Contacts” first before starting the search.

These are little improvements, but they definitely help make my daily computing activities more pleasant. (Thanks to Brad L. for the suggestion about the sidebar in iTunes.)

One Response to “Improved ‘Find’ command shortcut for iTunes (and Address Book)”

  1. Betalogue » Dumbing down Mac OS X: Lion’s Address Book says:

    […] a search. With previous versions of Address Book, I had written a Keyboard Maestro macro to automatically select all contacts before selecting the search field. Of course, with Lion’s Address Book, I was forced to rewrite my macro. I managed to do so, but […]