A Few Favorites v4
This macro opens apps, files, folders (including mounted drives) and -- (in version 4) opens URLs and pastes email addresses -- using either an HTML form or a Popup menu.
Apps are launched or, if already open, switched to the front. Files are opened by the default application. Folders can be opened in the Finder or an Open/Save dialog. Any URL protocol will open in a new tab in the front browser. Email addresses are pasted into the front window.
Lists of the various options are kept in separate text files you can access for editing directly from the macro.
ACKNOWLEDGEMENTS
This macro was inspired by two other macros:
-
Ccstone: Open a Folder in the Finder via a Path List in a User Prompt - #3 by ccstone
-
BKramer: Quickly Navigate to Favorite Finder Directories Via Dictionary-Generated List Prompt
It has also been inspired by feedback from earlier versions.
DEFAULT HOT KEYS
Version 4 is a change from earlier versions, using variations on the familiar space key used for other launchers like Spotlight.
-
Control-Shift-Space to call the HTML interface
-
Control-Space to call the Popup interface
-
Option-Shift-Space to add the Finder selection to a favorites file
FAVORITES FILES
The five favorites files (apps.txt, files.txt, folders.txt, urls.txt, emails.txt) use the same data format):
Heading
[tab]Descriptive Name[tab]Path[tab]@shortcut, @shortcut
Tilde is supported in the path (eg: ~/Documents rather than /Users/username/Documents).
Lines beginning with # are treated as comments.
Headings, which are only used by the HTML interface, are optional and ignored by the Popup list.
The listing can include a tag as a shortcut or even a filter indicating whether the path is to a folder or a file. The macro figures it out itself for the HTML form but the Popup can use a filter for navigating the lengthy list.
One character filters you may find useful include @a (for apps), @d (folders), @f (files), @u (urls), @e (emails). By typing just those two characters in the Popup interface, you can filter the list of options to that category.
These shortcuts are optional and disregarded by the HTML form.
OPERATION
On first run, you'll be prompted for the location of your favorite app, folders, files and URLs files. There are four: apps.txt, files.txt, folders.txt and urls.txt to facilitate adding Finder selections to the correct list.
Sample files are provided in the distribution, along with an images folder with the HTML interface's icons.
The HTML interface displays a separate list for apps, files, folders, URLs and emails with a label that is also a button to edit that list. The active list is indicated by a highlighted border in the HTML form. You can tab between lists. By default, you are addressed to Files. Tab to address Folders. Shift-Tab to address Apps. A Help button displays most of this information.
You can navigate the HTML form by typing the name of the item you want or repeatedly typing the first letter. When you have arrived at the item you want, just type Return or click the OK button on the HTML form. You can also double-click an entry.
The Popup simulates the HTML buttons with a "[Text]" convention. It has four options that begin with "[Edit" at the bottom to edit any of the four source files, as well as a "[Help]" option.
You can navigate the Popup by typing the item's name or its tag to narrow the list. Press Return or double click on the item.
If you select an app, the macro will launch the app or, if it's already running, switch to it.
It will open any favorite file in its default application.
If you select a folder with an Open/Save dialog is at the front, the macro will redirect the dialog to the appropriate folder, otherwise it will open the selected folder in the Finder.
You can add a selected app, file, folder or URL webloc in the Finder, by using the Option-Shift-Space hot key. The macro will ask how you want to add it to the appropriate source file. If you add it, you'll be asked if you want to edit the file so you can move the new listing.
A URL webloc is simply a URL dragged from your browser's URL field to the Desktop. A typical webloc might, for example, appear as "https--en.wikipedia.org-wiki-List_of_URI_schemes" on the Desktop. The macro reformats that file name into a legal URL.
Email addresses must be manually entered into emails.txt since only Finder selections are read by the macro. They are pasted using the email convention of "Recipient Name email@address" so email clients show a readable name but use the email address.
Listings are not sorted by the macro. You can order them however you like and that's how they'll appear.
INSTALLATION
The macro is installed in its own macro group named MacroApp: A Few Favorites as A Few Favorites, available to all applications all the time. You will have to enable it, however.
The default hot key is Space with various modifiers that do not conflict with Spotlight:
- Control-Shift-Space to call the HTML interface
- Control-Space to call the Popup interface
- Option-Shift-Space to add the Finder selection to a favorites file
Favorites ships with sample favorite files you can copy to a folder in a convenient location along with a subfolder of icons the HTML interface requires. The macro will ask for the location of that folder on first run.
You can populate those files by selecting apps, folders, files and URLs but you'll want to manually edit them into helpful categories if you use the HTML form.
There is only one global variable used (favsHome). It remembers where your text files are. All the other variables are locals that are not saved.
Icons are from the IcoMoon-Free set from Keyamoon (http://keyamoon.com). They are installed with the favorites files in a sub-folder names "images."
CUSTOMIZATION
You can change the hot key, of course. I choose the Space key to match other launchers I use.
And you can swap which interface requires the Shift key by making the Shift the pressed modifier and deselecting it in the not pressed row of the appropriate If action.
If you use rather long stubs to describe your paths, the width of the HTML "select" field will grow and push the others to a new row, obscuring them. Keep your slugs to no more than 18 characters to avoid this. Alternately, you can widen the window.
You can pick which of the five HTML "select" lists gets focus by moving the "autofocus" option to the "select" you prefer. The default sets Files to autofocus so Shift-Tab moves to Apps and Tab moves to Folders.
NOTES
I've established a different tag for apps, files, folders, URLs and email addresses so I can filter the list in the Popup interface: @a is for apps, @f for files, @d for folders (directories) and @u for URLs. And buttons all begin with "[". That can provide a similar function to the four "select" lists in the HTML form.
I've set variables to check for the Shift and Option keys to avoid any processing delay caused by the initial code that would miss the key press.
I've also put a short Help text (based on this document) in a variable because it appears twice in the macro. This way the text is stored only once and, as a local variable, not remembered outside the macro.
The macro distinguishes file types by the extension. It knows .app is used for .apps and any other three or four character extension is a file. URLs are distinquished by the URL protocol delimiter (://). Anything else is assumed to be a folder. This has worked reliably in my testing.
The Option key replaced an earlier version which just looked for a Finder selection. I found that I often had a Finder selection somewhere, which I had no intention of adding to a favorites list. So I reverted a more conscious implementation over automatic. You always know when you want to add a selection to a file.
You can also add multiple selections to a variety of files, too. You'll be prompted for each one.
And you can add external and internal drives to the folders list as well.
Adobe Open/Save dialogs are unmoved by this macro. Otherwise it has worked well with the applications we've used.
For the full documentation, see the PDF that accompanies this post.
A Few Favorites.4.zip (21.1 KB)
Favorites.pdf.zip (709.3 KB)