Alfred by Running with Crayons Ltd. is an award-winning app for macOS which boosts your efficiency with hotkeys, keywords, text expansion and more.
HoudahSpot is a powerful file search tool. It takes the guesswork out of Spotlight searches and helps you find files hidden deep in the “haystack” of files accumulated over the years.
HoudahSpot 5 includes an Alfred workflow that provides an elegant way to start a HoudahSpot search using Alfred. You can install this workflow from HoudahSpot > Preferences > Extensions.
Note: Workflows are part of the extended Alfred feature set. This needs to be unlocked by purchasing the Alfred Powerpack .
The workflow is triggered using the hs keyword in Alfred. You may need to use the arrow keys to select the workflow. Press the space key to activate the workflow.
The workflow accepts text input. Select the workflow in Alfred and enter the text you want to search for. The workflow will start a HoudahSpot search with the text.
The Alfred workflow installed by HoudahSpot uses your default search setup: the search criteria, location, result columns, and sort order that you have defined as the default for new windows.
Custom Workflow: Find Video Files
You can create versions of the workflow that instead use one of your search templates. For this post, we will adapt the Alfred workflow to find video files.
Start by opening the Alfred’s Workflow Preferences. Select Preferences… from the Alfred menu. Then select the Workflows tab.
Select the Search HoudahSpot workflow that you have previously installed from HoudahSpot > Preferences > Extensions.
Right-click or control-click the workflow to reveal the context menu. Select Duplicate.
From the context menu on the new workflow select Edit Details. Rename the workflow to Search Video Files. You may also want to update the description and author information. The workflow also has a longer description that you can update from the [x] (Configure workflow and variables) button in the top right corner of the workflow editor.
Double-click keyword input object in the workflow editor. Set a keyword for the new workflow: hsv. You should also want to update the title and subtext. You will see these when searching for workflows in the Alfred window.
The HoudahSpot4:// URL scheme
The input object is wired to a Open URL action. This takes the input gathered previously and works it into a URL and then opens that URL. This makes HoudahSpot open a new window with the text inserted in the main search field.
HoudahSpot then searches for files matching the text you have entered. With the factory default setup, this searches any text attribute (e.g. name, text content, author, tags, etc.) of files. You may have customized your default setup to search only names or text content.
The URL currently uses only one parameter: q or query. We will add a t or template parameter to make HoudahSpot use a search template instead of the default setup. The value of this parameter is the path of the template we want to use.
HoudahSpot includes a sample template to search HD Videos. We will point the action to that template. The action conveniently already includes a way of URL-encoding parameter values. This encodes spaces and other special characters in a form that is safe to include in URLs. We thus don’t need to worry about spaces or special characters in the URL. We can simply add a parameter with the path to the template. The URL now reads:
houdahspot4://search?q={query}&t=~/Library/Application Support/com.houdah.HoudahSpot4/Sample Templates HS5/HD Videos.hstemplate
When we later use the workflow and type “Steve Jobs” in Alfred, the action will build and open the following URL:
houdahspot4://search?q=Steve%20Jobs&t=~/Library/Application Support/com.houdah.HoudahSpot4/Sample%20Templates%20HS5/HD%20Videos.hstemplate
Ready to Use
Close Alfred preferences and give your new workflow a try:
- Invoke Alfred
- Type your abbreviation: hsv
- Use the arrow keys to select the new workflow
- Press the Space bar
- Type your search text
- Press the Return key
Not working? Download the Search Video Files workflow and compare it to your version.
Hotkey Triggers
Workflows in Alfred can be set up to trigger actions on the press of a hotkey. Combine a Hotkey trigger with an Open URL action to open a HoudahSpot search template on the press of a key combination.
Power Users
Ready for more? Refer to the HoudahSpot User Guide for more details on the different parameters supported by the houdahspot4:// URL scheme.
The user guide also describes advanced uses of the main search field. Since the text passed by the query parameter is inserted into that search field, you can have the Open URL action build a URL that creates such an advanced search from text you will enter in Alfred.
The following, for example, can start a case sensitive search:
houdahspot4://search?q=*:"{query}"dwt