"Literary Toolbox" Palette

See the most recent version in Post #21.


⠀Macro: Literary Toolbox
⠀Author: Mike Pasini
⠀Version: 1.0a
⠀Last Update: 3 December 2018

This set of macros can be used to evaluate text in several different ways. They can be helpful to authors but also to readers evaluating or studying various texts.

They each work on a text selection rather than a discrete file, parsing the selection copied to the clipboard and stripping it of any style information before analysis.

That helps (if isn't quite a cure) for text selected in a word processor. But you should have no problem with text selections made in any editor or within a Web browser.

Some of the tools push the limits of what an algorithm can tell us about human communication but we still find them useful if not for raw data at least for comparisons or trends.

We've used some of these for years and some for a few months. And while they do tap into the power of some third-party code, only a couple rely on commercial software and even those have free equivalents.

Keyboard Maestro provides a simple interface to these tools. A palette (with an optional custom color scheme) organizes them for easy recall. And custom HTML forms that use the same color scheme as the palette provide easy-to-read reports.

Sample reports:





The .zip file contains the PDF documentation and the complete palette.

LiteraryToolbox.10a.zip (783.5 KB)


Attempted install cpanm got this error:

BernsHome$ curl -L http://cpanmin.us | perl - --sudo App::cpanminus
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 295k 100 295k 0 0 1134k 0 --:--:-- --:--:-- --:--:-- 1137k
--> Working on App::cpanminus
Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7044.tar.gz ... OK
Configuring App-cpanminus-1.7044 ... OK
Building and testing App-cpanminus-1.7044 ... FAIL
! Installing App::cpanminus failed. See /Users/BernsHome/.cpanm/work/1544194574.41445/build.log for details. Retry with --force to force install it.

Here's the last line of the build.log with the failed step:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
-> FAIL Installing App::cpanminus failed. See /Users/BernsHome/.cpanm/work/1544194574.41445/build.log for details. Retry with --force to force install it.

Do you have any suggestions?


I do have Xcode installed, which may have created that missing directory for me.

One simple thing to try at the commend line is this solution:

xcode-select --install

Hope that helps!

Installing the command line developer tools handled the cpanminus install.

Now the last distribution from "cpan at https://metacpan.org/ pod/Lingua::EN::Grammarian" to retrieve the caution and error files returns a 404 page not found error.

Any other way to get the files?


That URL looks suspicious (there's a space in it). But the original source does specify this command line:

cpanm Lingua::EN::Grammarian

(And you'll need that link to get the error and caution files, too.)


I found the cpan install for Grammarian from my Terminal session and it looks like this:

MikePasinisMBP:~ mrpasini$ cpanm Lingua::EN::Grammarian --sudo
--> Working on Lingua::EN::Grammarian
Fetching http://www.cpan.org/authors/id/D/DC/DCONWAY/Lingua-EN-Grammarian-0.000005.tar.gz ... OK
Configuring Lingua-EN-Grammarian-0.000005 ... OK
Building and testing Lingua-EN-Grammarian-0.000005 ... Password:
Successfully installed Lingua-EN-Grammarian-0.000005
1 distribution installed

You are correct. The Literary Toolbox pdf version has that URL with a line wrap. Copying and pasting from the pdf inserts a space where the line wraps to the next line. Removing the space got me to the correct page.

Onto installing the error and caution files...


Thanks for your persistence. When you get through the installation, I'll update the PDF to cover these issues.

13 Dec. Update

I'll replaced the original distribution above with the same macro file but updated documentation to reflect the discussion above.

1 Like

Hi, I managed to install everything but some macros are not running. During the installation process these were the errors:

==> Found dependencies: Package::Stash::XS
--> Working on Package::Stash::XS
Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Package-Stash-XS-0.29.tar.gz ... OK
Configuring Package-Stash-XS-0.29 ... OK
Building and testing Package-Stash-XS-0.29 ... FAIL
! Installing Package::Stash::XS failed. See /Users/Alfredo/.cpanm/work/1547686509.2318/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'Package::Stash::XS' is not installed
! Bailing out the installation for Package-Stash-0.38.
! Installing the dependencies failed: Module 'Package::Stash' is not installed
! Bailing out the installation for namespace-clean-0.27.
! Installing the dependencies failed: Module 'namespace::clean' is not installed, Module 'strictures' is not installed
! Bailing out the installation for Lingua-EN-Opinion-0.1300.

Configuring Lingua-EN-Tagger-0.30 ... OK
==> Found dependencies: HTML::Parser
--> Working on HTML::Parser
Fetching http://www.cpan.org/authors/id/G/GA/GAAS/HTML-Parser-3.72.tar.gz ... OK
Configuring HTML-Parser-3.72 ... OK
Building and testing HTML-Parser-3.72 ... FAIL
! Installing HTML::Parser failed. See /Users/Alfredo/.cpanm/work/1547686534.3287/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Module 'HTML::Parser' is not installed
! Bailing out the installation for Lingua-EN-Tagger-0.30.

What do yo recommend me to do?
Thanks in advance!

Take a look at the log files reported by the install process:

  • See /Users/Alfredo/.cpanm/work/1547686509.2318/build.log for details
  • See /Users/Alfredo/.cpanm/work/1547686534.3287/build.log for details

There may be something cpanm does not expect about your Perl installation.

1 Like

Hi MrPasini,
1-Tried to install Perl, but got an ERROR: "Please delete /Users/MyUser/.cpanm and then re-run this command.

2- Got rid of ".cpanm" using "sudo rm -rf /Users/MyUser/.cpanm"

3- Installed Perl again by means of "curl -L http://xrl.us/installperlosx | bash"

4- Got Perl 5, version 28, subversion 0 (v5.28.0)

5- It runs better

Nevertheless, for some functions I still receive this ERROR:
"Can't locate Lingua/EN/Fathom.pm in @INC (you may need to install the Lingua::EN::Fathom module)
(@INC contains: /Library/Perl/5.18/darwin-thread-multi-2level /Library/Perl/5.18 /Network/Library/Perl/5.18/darwin-thread-multi-2level /Network/Library/Perl/5.18 /Library/Perl/Updates/5.18.2 /System/Library/Perl/5.18/darwin-thread-multi-2level /System/Library/Perl/5.18 /System/Library/Perl/Extras/5.18/darwin-thread-multi-2level /System/Library/Perl/Extras/5.18 .) at /var/folders/py/gvw054lj2j171rhjn6zd01kh0000gn/T/Keyboard-Maestro-Script-A353C5A9-22B9-453F-A67C-BF4821581A95 line 3. BEGIN failed--compilation aborted at /var/folders/py/gvw054lj2j171rhjn6zd01kh0000gn/T/Keyboard-Maestro-Script-A353C5A9-22B9-453F-A67C-BF4821581A95 line 3."

Well, same answer as last time. Your Perl installation is not standard.

MacOS ships with Perl installed (and has for a long time). On Sierra, which is what I'm running, the installed version is v5.18.2 and can be found in /usr/bin/.

Assuming that installation, cpanm will install the required modules where Perl can find them.

The error message you are getting is telling you that your Perl installation can't find the required modules in any of the places it normally looks (that's what the @INC is all about). You'll notice most of those places are in "5.18" subdirectories, which would not be accessed by Perl v5.28.

You can add directories to that list, of course, but I suspect you don't know where the modules were installed.

If, that is, the modules have actually been installed, which isn't clear. That would have appeared between steps 4 and 5.

You might try reinstalling the modules so they're accessible to your new Perl installation. Or, failing that, fall back to Perl 5.18, which is what your @INC is expecting.

With a clean install of MacOS, you don't need to install Perl and the default Perl installation will find any modules installed by cpanm.

You have a custom install of Perl somewhere on your disk ("which Perl" in Terminal will tell you where) and that install can't find the required modules for this palette.

3 posts were merged into an existing topic: Next version of KM in 2019?

I discovered an issue with the regex in the Most Frequentlty Used option which did not isolate the strings as complete words, omitting longer words from the counts. Version 1.0b corrects that:

Literary Toolbox.10b.zip (783.8 KB)

1 Like

Thanks for the update.
To ensure that all new readers see your latest update, I added your update post to your OP. Please feel free to further edit if you so desire.

Literary Toolbox 10c

This release shows Grammarian citations in context (at last). It also revises the HTML window CSS slightly.

You won't have to reinstall any of the Perl modules. Only the Keyboard Maestro palette changes.

Updated documentation is included in the ZIP file.

Literary Toolbox.10c.zip (811.9 KB)

Here's a slight change to the Custom HTML of the Most Used Words and Word Frequency macros I'm trying out locally that you may want to use:

	<style type="text/css">
body{background-color:black;font:.80em "Lucida Grande",serif;color:#36aac2;margin:0;}#title{background-color:#36aac2;color:white;text-shadow:2px 2px 3px #26aac2;padding-left:12px;font-size:1.1em;width:228px;padding-top:5px;padding-bottom:5px;margin-bottom:8px;text-transform:uppercase;letter-spacing:6px;font-weight:bold}#text{align:left;padding:2em;padding-top:.25em;column-count:2}

That column-count:2 at then end gives you a two-column display for those lists. The CSS also deletes the span section, which isn't used.

1 Like

I added an update notice to your OP at the top.

Thanks, tried to edit it but wasn't allowed.

I think the command for custom palette change through the terminal is wrong in the manual. It is missing "-string". So it worked for me after entering the command like this:

defaults write com.stairways.keyboardmaestro.engine CustomPaletteTheme -string "0,0,0, 190,72,76, 0,0,100"

Thanks @slimhan. That appears to be a change in syntax.

In Custom Palette Style Colors?, Peter Lewis cites the stringless syntax (but that was 2016). And I see that in the Wiki Preferences reference it is now stringed.

On another note, when I moved to Mojave I had to change the way Spell Catcher is called to check a document. I still prefer its batch mode but I suspect I'm the last person on earth using it.

I'll include that revision (as well as the two-column Most Used Words and Word Frequency reports) in the update coming shortly.

Again, thanks for pointing that out.

1 Like

Literary Toolbox 10e

This release uses a two-column display for the Most Used Words and Word Frequency reports, updates the Spell Catcher batch spell check to work with Mojave (thanks to Chris Stone) and updates the documentation to use the current syntax for the custom theme (thanks to slimhan).

LiteraryToolbox.10e.zip (812.8 KB)