Automate HoudahSpot

This post refers to HoudahSpot 3. There have been major improvements to Apple Script and URL actions in HoudahSpot 4. Please refer to the User Guide for details.

HoudahSpot integrates nicely with your automated workflows. Use the custom URL scheme to start HoudahSpot searches from third party tools like LaunchBar and Alfred. Use AppleScript to access search results and build more advanced workflows.

The custom URL scheme supports 3 commands

1. blitzSearch – start a search

Example:
hhspot://blitzSearch?searchString=*&filenameFlag=YES&contentFlag=YES&commentsFlag=YES

Arguments:

  • searchString: text to search for
  • anyTextFlag: set to YES to add an “Any text” criterion to your search
  • filenameFlag: set to YES to add a “Name” criterion to your search
  • contentFlag: set to YES to add a “Text Content” criterion to your search
  • commentsFlag: set to YES to add a “Spotlight Comment” criterion to your search
  • finderScopeFlag: set to YES to search the location of the current Finder window
  • templateName: name of the template to base the search on. BlitzSearch criteria are added to existing criteria
  • tag: name of the tag to search for. Multiple occurrences allowed
  • matchAnyTagFlag: set to YES to find files matching any (rather than all) specified tags
  • scopeLocation: folder location to search. Multiple occurrences allowed

2. keywordTagSearch – search for files by Open Meta tags, Finder tags or keywords

Example:
hhspot://keywordTagSearch?tags=One,Two&matchAny=YES
  • tags: comma-separated list of tags to search for. You may need URL-encode the comma as %2C
  • matchAny: set to YES to find files matching any (rather than all) specified tags

3. tagSearch – search for files by Open Meta tags

Example:
hhspot://tagSearch?tags=One,Two&matchAny=YES
  • tags: comma-separated list of tags to search for. You may need URL-encode the comma as %2C
  • matchAny: set to YES to find files matching any (rather than all) specified tags

HoudahSpot implements the following AppleScript commands:

  1. blitzSearch – start a search
  2. folderSearch – create a search scoped to the specified folder location
  3. openTemplate – create a search from a template
  4. folderSearch – create a search scoped to the location of the current Finder window
  5. tagSearch – search for files by Open Meta tags
  6. keywordTagSearch – search for files by Open Meta tags, Finder tags or keywords
You may also access the names and file paths of search results using AppleScript:
tell application "HoudahSpot"
    set allPaths to path of every result of first document
end tell
Please refer to the AppleScript dictionary for details on the arguments to the above commands.