Sunday, May 27, 2012

PC-Style Home/End Keys For Mac

As a PC user by day, Mac user by night, I have a few gripes.  One of them deals with the Mac's implementation of the Home and End keys.  I think Windows has won here by assigning less frequent tasks to modifier key combinations.  The Mac, on other hand, takes you to the top or bottom of a page without modifier keys. To make matters worse, the default action does not move your cursor along with the change in view.  It's rare that I'd ever want to do this and by not moving the cursor along, it's fairly useless.  I'm constantly misusing them to the point of being distracted by it.

I found a utility app called DoubleCommand that goes a long way to solving the problem. The app was made for users to remap keys when using PC keyboards on a Mac.  It has an option to make Home/End behave more PC-like. Amen. Press the End key by itself and you'll go the the end of current LINE. Vice versa for the Home key. Holding Shift down while pressing these keys selects the text along the way.

Friday, May 25, 2012

Efficiently Rate Your Music Collection Into Submission

The Problem

I want to rate the tracks in my music collection efficiently. The ratings can be used to:
  1. Generate playlists
  2. Remove music I don't like
  3. Share music that I like with friends
  4. Pick the music to be synced across my devices
The problem is that there are too many steps to rate music as you listen to it.  It's a perfect multitasking activity, but most media players don't provide anything out of the box to help you keep on task.  The standard workflow is to switch to your media player, rate the currently playing track, select the next track to play, and then switch back to what you were doing.  That's four steps!

In reality, you get sucked into spending most of your time in the media player because of tracks that rate poorly.  Those sad tracks tend to come in groups, especially on albums with the typical quota of one to three good tracks.  So, instead of thrashing back and forth between your media player and your work, you stay in the media player waiting to get to a track you are willing to listen to for a while before rating.  Eventually, you start enjoying a track too much and forget to rate it or you simply find the idea of breaking your train of thought yet again too frustrating.  So you give up.  You're left with a handful of tracks rated and one more promise of technology unfulfilled.  Before you know it, you spend all of your time on Pandora, last.fm, or Spotify and you try to forget all of that time you spent ripping your music collection to mp3s. :)

Well, I think there's some hope.

A Solution

How about being able to rate the currently playing track and start playing the next unrated track without ever having to leave your work, and do this in one step!?  It's as good as it gets, I think.

Here's a guide to setting up global keyboard shortcuts and voice commands on a Mac to rate your music in iTunes.  Between hotkeys and voice commands, you should be able to rate music easily in any scenario.  I'll try to follow up with a Windows guide later.  If you don't like iTunes, you should be able to apply the basic concepts here using just about any media player.

Here's an outline of the steps:

- Configure iTune to show half-star ratings (ex. 3.5 stars).
- Install AppleScripts that automate iTunes. I provide the scripts below.
- We'll place the scripts in a special folder for speech commands and name the scripts properly to turn them into voice commands.
- For global keyboard shortcuts, we'll install a great utility called Spark and then configure Spark to use the scripts.
- Create a smart playlist that only includes unrated tracks.
- We'll set iTunes to shuffle and then play our unrated tracks smart playlist. As we go about our normal routine on the computer, or up and about getting things done around the house, we'll easily rate our music using the global keyboard shortcuts or the voice commands. Headphones with a microphone are recommended for voice commands.

1.  Configure iTunes to show half-stars for ratings

First, quit iTunes, then enter this command in Terminal:

defaults write com.apple.iTunes allow-half-stars -bool TRUE

Relaunch iTunes, and you'll find you can now click between the stars (in the Ratings column) to get half ratings.  You can also drag across the stars and you'll see the half ratings.

2.  Install iTunes AppleScripts

Download the scripts I created first. Extract the scripts into the following folder: /Users/{Your Username}/Library/Speech/Speakable Items. One way to access the Library folder is to open the Go menu in Finder and hold down the Options key on your keyboard. Library should now be visible. Choose Library and then navigate to Speech/Speakable Items.

The filename of each script will become the voice command. You are free to reword the filenames, but make sure to keep the file extension in tact (.scpt) as it's needed by Spark in a future step.  Don't worry, the filename extension will not be part of the voice command so there's no need to figure out how to pronounce scpt.

Speakable Items folder

3.  Install and Configure Spark

Download Spark and install it.  It's a really great shortcut key utility for the Mac.

Next, you need to assign shortcut keys to the AppleScripts.

Example Spark Setup
To add the hotkeys:

  1. Click the large button on the toolbar to choose "All Application's Hotkeys" since we want to create global, system-wide shortcuts.
  2. Click the Gear drop-down button on the toolbar and choose AppleScript. This tells Spark that you're going to create a new keyboard shortcut that can be used from any application and it will launch an AppleScript.
  3. In the configuration page that appears, choose the hotkey (I used control+option+function keys for each rating level), name the shortcut whatever you want (it's just to help you identify the shortcut within Spark), and click file then choose the corresponding AppleScript file located in the Speakable Items folder.
  4. Click the "Start Spark Daemon" button.

4.  Create Smart Playlist

In iTunes, choose "New Smart Playlist" from the File drop-down menu.  Then create a rule where Rating is less than 1 star or equal to no stars.  Take your pick.  My rule is for less than 1 star which means it will include tracks that were assigned 0.5 stars.  If I'm undecided about deleting a track, I give it a 0.5 so that it will appear again in the rotation later for me to consider again.


5.  Start Rating Your Music!


  1. Turn on shuffle in iTunes.
  2. Start playing your Unrated Music Playlist.
  3. Test your hotkeys: No matter whether you are in iTunes or another application, you should be able to use your hotkeys to assign a star rating to the currently playing track and skip to the next track immediately.
  4. Enable Speech Recognition in System Preferences. Using a headset with a microphone, try issuing the speech commands to rate tracks.  I find that my voice commands are not well understood if my microphone sensitivity is too high. Make sure to use the mic calibration tool and keep the bars in middle greens.

Supplied Scripts

Along with the ratings scripts, I created scripts for:
  • Going to the previous and next tracks.
  • Going back and forth 30 seconds at a time within the currently playing track.
  • A script to delete the currently playing track and skip to the next track.
I see these as the essential scripts for rating tracks.  You may want to add your own (like scripts that rate the currently playing track, but don't skip to the next track immediately).  To make your own script, just copy and paste one of the existing scripts in Finder, give it a new name, and then double-click it to open it for editing.

Good luck and long live your music collection!


Monday, May 21, 2012

Quick Search

I finally figured out just how short life is and I'm in the process of consolidation. I'm retiring my personal website and moving over to free blogs. I had a page on my site that is still relevant and useful about something called Quick Search. Here's an updated version:

Most web browsers today allow you to perform site-specific searches or "macros" from the address bar.  Internet Explorer was the first one implementing such a feature that I was aware of many years ago called IE Quick Search (as a "Web Accessory" for IE4 and standard functionality in IE5).  Essentially, you could navigate to and search on a website in one step by typing a command like this into the address bar:

imdb Being There

By typing this into the address bar, you'd be taken to imdb.com to see the search results for the movie, "Being There."  Nice time saver. It was a powerful feature in a time before Chrome and unified "Omnibar" address bars.

Omnibars configured to search on Google come close to replacing Quick Search, but there's still the extra step of visiting Google before getting to your destination site. For that reason alone, Quick Search is still valuable.


IE QuickSearch


IE Quick Search was configured via registry entries. At the time, I put together a registry file with a bunch of useful macros. I haven't tested them in a long time.  I'm sure half work and half don't.  Come to think of it, this little reference sheet is an interesting test of the hows and whys of web UI and API stability, to some degree.

Here's the registry file to import Quick Search commands
Here's a reference sheet for the Quick Search commands

If you look at the registry file, you'll quickly see that %s in a URL is replaced by whatever the user searches for, such as "Being There" in the example above.


Other Browsers


In the past, if you told Firefox to import IE settings, you'd get the Quicksearch entries. I suspect this is still true and perhaps Chrome does it too.  You'll have to find out for yourself.

If you want to create new entries manually:

Chrome:  Go to Tools > Settings > Search Engines.  Here, you can add keywords and URLs with %s for the search term placeholder.

In Firefox, you add keywords to bookmarks.
Firefox: Bookmarks > Show All Bookmarks.



To create your own Quick Searches, you'll need to figure out how to compose the URL and where to put the %s token.  Usually, you can do a search on a site and then look for the keywords you entered in resulting page's URL.  Sometimes though, you'll need to do some extra work if the page is posted or the site redirects or the data is obfuscated, etc..  It's not my intent to teach these things in this post.

Quick Search can also be useful for searching your personal or business web applications. Furthermore, you could create macros that actually do work instead of search for things.  Quick Search macros could send text messages, add items to databases, create events, etc..

Oh, there was a site that came along a long time ago that took the idea of Quick Search to a new level.  I'll try to find them and update the post.