Use Dict (Homebrew Package) to Get a Word's Definition

Howdy folks, I've been trying to learn some how to work with shell scripts lately, so I've been making great use of Homebrew packages to make some basic macros.

My latest one is a simple macro to get a word's definition using Dict (a Homebrew package). It selects the word to the left of the cursor, and displays it's definition in a window.

Attached is a screen recording of it in action.

While the macro works quite well for me (and why I posted it here, and not in the Questions and Suggestions category), I'm still interested in everybody's thoughts and ideas if this macro can be improved. Thanks in advance, and if this macro proves useful to anybody else then enjoy!

-Chris

NOTE: This macro has special requirements to run

This macro makes use of the following KM version 10 action(s):
Position next engine window
If you are running a previous version of KM, simply disable or remove said action(s).

This macro requires Homebrew to be installed. Click the link for more info.

This macro requires Dict (a Homebrew package) to be installed. Click the link for more info.

This macro requires the end-user to set a ENV_PATH variable (or specify the path in the shell script). Click the link for more info.

CURRENT VERSION: 1.2.0 (Friday, May 20, 2022)

v1.2.0: Added filtering out any non-alpha character in case word is part of a list etc. (Friday, May 20, 2022)

v1.0.1: Switched from named clipboard to system clipboard and added steps to restore original system clipboard (Friday, January 28, 2022)

v1.0: Initial macro (Friday, January 21, 2022)

dictionary macro

50)Dictionary.kmmacros (47 KB)

Macro screenshot (click to expand/collapse)

3 Likes

Version 1.0.1 is up.

The only changes are using the system clipboard instead of the previous named clipboard as well as restoring the original system clipboard.

Version 1.2.0 is up.

I added steps to filter out non-alpha characters to remove any unwanted characters in case the word is the first word of a list etc.

This is really fun. Thanks for sharing.

Glad you’re enjoying it!