Textcavator 2018


Please see Textcavator 2021 for the most recent version.


This macro prompts for a search string with an option to ignore case to explore a top directory and any enclosing directories for specific file types. Those include files with these extensions: txt, htm, html, php, indd, qxp, rtf, pl. You can safely extend this list.

The reason I wrote it, though, was to have a nicely formatted report that shows the hits in context so I can tell without opening the file what was discussed.

And Textcavator does that.

Here's a screenshot of the initial prompt.


As you can see, there are a few options, too. You can set the highlight color pointing out the search term in context to anything you want. You can get multilingual audio feedback (some of the searches take a while). And you can point the file picker to your preferred jumping off spot.

The Start Folder option is a popup because you can populate it with locations on your disk that you frequently want to search. It also has an 'Other' option to select any location, which it will remember and present as an option below the 'Other' option.

The Search String can be a regular expression (as the screenshot shows) or not.

Here's a screenshot of the bottom part of the report so you can see Textcavator's main virtue (in-context quoting):


To get the file picker with a default location and a progress bar, the distribution includes CocoaDialog, which you just drop into your main Applications folder.

A full PDF manual is included in the distribution.

Textcavator.10b.zip (1.5 MB)

updated 2018-03-31 18:35 GMT-0500


Textcavator Tip

When setting up your list of favorite directories to search, the manual shows this example code for listing your Desktop:

<option value="/Users/username/Desktop/">/Users/[username]/Desktop/</option>

There’s no obligation, however, to use the whole path in the descriptive part of that command. If you prefer, you can simply write:

<option value="/Users/[username]/Desktop/">Desktop</option>

That goes for any option you want to list. The description between the > and < delimiters can be anything. The form passes the actual path listed in the value to the Perl script for processing.

Textcavator 1.0b

I’ve replaced the original download (1.0a) with a new version that makes the following changes:

  • Corrected the Keyboard Maestro variable name for the default folder that did not have the TC precede.

  • Added a tip in this documentation about describing folder targets.

The code change resolves an issue where the value of the Default Folder was not read by the Perl script. When you selected Other as the Starting Folder, the file picker was unable to start from your Default Folder.

Textcavator 1.1a

This update to Textcavator adds support for uses Microsoft Word documents in the doc or docx format.

Textcavator uses Apple's textutil (available in OS X since version 10.4) to read any Word file it encounters, creating a temporary text file for processing normally. After the temporary file has been read, it's deleted.

Textcavator.11a.zip (1.5 MB)

1 Like

Thanks for the update.

To make sure new readers see the latest version, I have revised your OP at the top to provide this announcement. If you’d prefer not to do this, or have other comments you’d like to add to your OP, please let me know.

I did wonder about that. Thanks for the solution. I had thought the earlier post would be closed for editing.

Good job!!
Guy, we are rolling! :slight_smile:


wow this looks amazing

i cant get it to work and get an error

i have followed the guide

here is an example search


what am i missing here :smiley:


I've never seen that warning on top myself. It apparently has to do with the XCode installation. See this discussion for more but it seems to be harmless.

The other issue reported by Textcavator is that it can't find a particular file in the Other directory you are pointing to. That H2020 directory referenced by the error may not exists or may not be readable. Or, as the error says, there may not be any files in it or the files in it can not be opened (again perhaps a permissions problem).

So I'd explore the directory/file issue (copy the files to a new directory on the Desktop to see if Textcavator can access them there, for example).

Hope that helps.

Textcavator 2 Coming Soon

Just a note to say I'm working on a major revision to this search tool that adds a filename mask and revises the interface (both the prompt and report).

If there's anything else you'd like to see in the new version, now's a good time to bring it up. Thanks!


1 Like

Well "soon" is relative, I suppose. Textcavator 2020 has been evolving here in unexpected ways.

Trying to think of a familiar way to describe it, I thought it's really a Google search for your own hard drive. So why doesn't it look like Google search?

That led me to develop an optional interface:


It shows the search location below the search term prompt. And it picks that up from 1) a folder you've selected in Finder, 2) the last directory you searched with Textcavator or 3) your default starting directory.

No buttons, just hit Return.

Meanwhile the more elaborate interface has picked up an option to sort the results.


There are six options (ascending and descending for filename, creation date and modification date).

And I added a "Whole Word" option to the search behavior.

All of which I'm testing and documenting now. Which has redefined the word "soon" a bit.


Textcavator 2020 Released

I've started a new thread for the new and improved Textcavator 2020, just released.