Arduino Esplora as a thermostat
Control an appliance based on temperature

Keyboard Maestro: Make Link with Title from Clipboard

This Keyboard Maestro macro is a key part of my blogging workflow. It retrieves the title of a webpage, massages the title to correct capitalization, then puts the title and URL in a fully-formatted href.

For example, let's say you want to link to the webpage "Is your documentation meant to be read?" at http://www.g2meyer.com/usablehelp/singles/709.html. Simply copy the URL to the clipboard, then invoke the macro (I use the Keyboard Maestro menu bar item for this.)

Now switch to the document where you want to use the link and paste the clipboard. The results will look like this:


< href="http://www.g2meyer.com/usablehelp/singles/709.html">Usable Help - Is Your Documentaton Meant to Be Read?< /a>

Notice that the title of the webpage has been changed to Title Case. Keyboard Maestro handily has built in support for John Gruber's fancy-schmancy scheme for doing this quite intelligently.

The macro is fairly straightforward. The meat of it uses Keyboard Maestro's variable support and a Python script to fetch the HTML source from the site and pull out the < title > tag. It does this in a very old-school fashion because I didn't want to require the use of any modules that aren't part of a standard Python installation.

GetTitle 6

The collapsed "Execute Shell Script" step contains the Python script, which you can download from gist.

If this macro tickles your fancy, check out Nothing Up My Sleeve: Keyboard Maestro: Wrap URL.

Update: Keyboard Maestro v6.0 makes this a lot easier.

Comments

The comments to this entry are closed.