Fun with basic dictionary

HOW TO VIDEOS.kmmacros (47.9 KB)

Accessories.zip (38.3 KB)

I have been trying to figure out use scenarios for dictionaries (first I had to figure out what exactly dictionaries are in the computing context). I have decided that my purposes are best served by creating a text file with key/value entries that is stored outside KM, but which KM can access via regex. (Hat tip to @JMichaelTX and @mrpasini!)

This macro demonstrates use of a simple dictionary-like text file stored outside KM. The dictionary here is a list of names of how-to videos (in this case, involving bread making), which correspond to links to YouTube tutorials I like to be able to call up quickly if I need to check technique.

The macro accesses the dictionary/text file (in the Accessories file), generates from that file a list of keys from which the user chooses (via the spotlight search action) a video, then it accesses from the dictionary/text file the corresponding URL for the chosen video and puts it up center screen in a pop-up web page via Automator workflow (also in the Accessories file), rather than in your main browser.

If you add an entry for another video to the dictionary file, the list will reflect that addition.

While this is a simple mock up intended to help me understand how to use dictionaries with KM, it has already helped me make far more sophisticated changes to some of my other macros using much larger database-like dictionary files.

This macro is disabled, and you'll need to be sure to input the paths to the dictionary/text file and pop-up webpage workflow so that the macro can access them. (Of course, if you don't want to use the pop-up workflow, you can just have the macro open the links in your browser. I personally like to keep my browser tabs to a minimum. ;-)).

image

2 Likes