"Literary Toolbox" Palette

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)



Just a note to say I'm providing a version of this macro that works on very large files.

I tried running a few of the analyses on an 84K file with the original macro group and it overran the environment size. So rather than reading the selection stored in a Keyboard Maestro variable, this version writes it to a temporary file, reads it into a Perl variable and deletes the temporary file, avoiding filling the environment space.

Keyboard Maestro can accept a variable of any size, as I understand it, but once the system environment is full, it deletes the largest variable, which causes the original version of this macro group to fail. This version avoids that.

Seems to work fine in my limited testing on two machines. It seems as fast as the original on an SSD but it's no slouch on a hard disk.

Update: Here it is. The temporary file is written to Users/Shared/temp.txt because that location doesn't depend on your user name. It's also deleted right after it is read. This version uses Option-F10 as the trigger (the original used F10) so you can use both.

BTW, no need to reinstall any of the supporting software. Just import the updated macro Literary Toolbox II.

Update (21 Jan. 2021): This version fixes an issue with the Concordance that did not maintain the original line endings in the report.

Update (9 Feb. 2021): Revised the location and name of the temporary file from Users/Shared/temp.txt to tmp/LT-temp.txt. It is, however, deleted immediately after it is read. Note, too, that some functions (like the grammar check) take a while to run on longer texts. This version, however, does not show a progress bar for them.

Update (8 March 2021): Updated code to handle revised Emotion module. Removed restrictions on InDesign CS5 as obsolete. Added WordNet Lookup option for selected word [undocumented beta]. And I just tweaked the WordNet Lookup with 1) a link on the headline word to the Princeton form for deeper exploration and 2) colored examples.

Update (10 March 2021): I've added the PDF of a draft of the revised manual as a separate download below.

Update (11 March 2021): A few changes:
• Added local WordNet Lookup option
• Change hot key for WordNet options
• Activated WordNet links in remote option
• Updated Spell Catcher word lookup
• Revised Spell Check Document to include some non-standard keyboard shortcuts which you can extend easily for other applications
• Revised documentation

Literary Toolbox II Macros.kmmacros (203.1 KB)

LiteraryToolbox.pdf.zip (740.2 KB)

Hey Mike,

I'd stay out of the user space and use the /tmp directory.


I suppose I could prompt for a location if the corresponding variable were blank rather than use a hard-coded location available on any machine. But what's the advantage? Or, to put it another way, what's the disadvantage to using the Users/Shared location briefly?

NB: I just saw a typo in the original message regarding the location of the temporary file. It's in Users/Shared not Users alone.

Hey Mike,

The /tmp directory is available on all Unix machines and is specifically designed as a destination for temporary files.

Staying out of the user space when you don't need to be in there is a basic safety measure.


1 Like

Ah, yes, forgot all about that. I've revised and replaced the group to use tmp/LT-temp.txt. And tested it, too.

Thanks for the help!

1 Like

it works like magic.
thank you a million mr pasini !