Jump to messages via alpha-numeric keys in Mail

Jul 16, '04 11:45:00AM

Contributed by: paulrob

The script below came about as the result of some discussions in the Forums sometime ago about Mail's inability to jump to a particular message when alphanumeric keys are pressed. In Finder and iTunes, pressing these keys jumps to the first item in the front window that starts with the pressed keys. Hopefully, this function will be provided in future versions of Mail. But until then, this script provides a workaround. The script makes use of the "keys pressed" function provided by Jon's Commands 3.0d3 osax.

Save the script as compiled script to /Library/Scripts/Mail Scripts, and update Mail's script menu. Use Sys Prefs to add in a keyboard shortcut for Mail to the script. The selected shortcut must be to one of the F-keys. The key selected to be the shortcut must be added to the script as property start_key. I have used the F1 key, as shown in the script. It is possible to use a key sequence other than a single F-key to start the script, but this makes the run handler more complicated, and I wanted it to be simple.

To use, order the message viewer either by sender, mailbox or subject; ascending or not doesn't matter. Then press the shortcut, and type the appropriate keys one-by-one. On slower machines, it will pay to wait until the message that most closely matches the previous key press is highlighted before proceeding with the next. The script will quit if no keys are pressed, after a user defined timeout. This is set at two seconds, with the property time_out line. This property can be adjusted for individual users.

Also note that the spaces cannot be used as a search key, as this tells Mail to scroll down one message, and interferes with the working of the script.

[robg adds: Due to the length of the script, I've uploaded it as a text file: mailkeys.txt. Just copy and paste the script into Script Editor, and this should work as described (with the required Jon's Commands, of course).]

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20040711120012754