Perl
Using Perl in Keyboard Maestro macros
One of the things that I love about Keyboard Maestro is the ability to chain together disparate technologies to achieve some automation goal on macOS.
In most of my previous posts about Keyboard Maestro macros, I’ve used Python or shell scripts, but I decided to draw on some decades-old experience with Perl to do a little text processing for a specific need.
Background
I want this text from Wiktionary:
to look like this:
More on integrating Hazel and DEVONthink
Stripping surveillance parameters from Facebook and Google links
While largely opaque to most users, Facebook and Google massage any links that you acquire on their sites to include data used to track you around the web. This script attempts to strip these surveillance parameters from the URL’s. It is by no means all-inclusive. Imaginably, there are links that I haven’t yet encountered and that need to be considered in a future version. So consider this a proof-of-concept.
The problem
For example, I performed a Google search1 for “Smarties”. Inspecting the first link - to Wikipedia, I see: