MACRO: Browse KM wiki topics in a pop-up window

I spend a lot of time in the Keyboard Maestro wiki, looking up various things. I got tired of switching to my browser, setting up its window next to my editor window, finding the page I wanted, etc.

So I wrote a little macro to open various wiki sections in a window placed at the edge of my screen, sized to fit next to my KM editor window:

This way I can easily browse for what I need, then press Escape when done and the window vanishes, all without leaving the editor.

I use a Prompt With List action to easily select which area of the wiki I'd like to browse:

As shown in the first line, if I need a more fully-featured wiki experience, I can hold down the Option key to open the selection in my browser; without it, the pop-up appears. I set up that choice because the pop-up window isn't a web browser-there are no Back and Forward buttons, for instance. So if I need a deeper dive into the wiki, I hold down the Option key…but for simple lookups, I just double-click.

The macro is actually incredibly simple, at least until you get to the "display the page" portion of it. Here's the base macro:

Screenshot of main macro

The work is done in the left side of each entry in the Prompt With List action. By listing the trailing part of the URL (the part after the base defined in localTheURL), it's captured with my selection, making it easy to add to the base URL in the next step.

It's also really easy to add an additional section of the wiki: Find the extension part of the URL, then enter a new row with that to the left of the double underscore, and your label to the right.

The full URL is then either passed to the browser, or to the subroutine that creates the pop-up window (where you can specify the window size).

I made the web page section a subroutine because it can be used to open any URL you want—just pass the URL, and the desired window dimensions, and you're done. I put this code to use in many of my other macros. And this subroutine is not quite as simple as the main macro:

Screenshot of web page display macro

I wish I could credit those who helped that bit of HTML/Javascript come into existence; I remember scouring the forums here, taking tidbits and larger chunks from various posts—most of the code is not mine—but I don't remember whose code it was I borrowed :(.

You can easily change the dimensions of the window, and there are instructions in the subroutine on how to change its alignment from right edge to midscreen. It's also possible to put it wherever you like by changing the values in the <body data-kmhandleschemes... line.

I keep the main macro in a group that's only active when Keyboard Maestro is frontmost, and have it assigned to Control-K. (The subroutine is in a global folder, as I use it elsewhere.)

__ Browse KM Wiki topics Macros.kmmacros (12 KB)

Not an overly complicated thing, but I use it every day, and love the fact that it lets me stay in the editor when I want to look something up.

-rob.

11 Likes

Hey Rob, great macro, thanks for sharing. I don’t reference the Wiki very often, and when I do, I have an Alfred workflow to quickly access it’s pages, but this is a great method too and one I might end up using instead of Alfred. Either way, the subroutine alone is quite valuable!

-Chris

1 Like

Very handy. Good work!

FWIW, I edited it on my system to be self-contained, which meant that the logic could be condensed slightly. I've hard-coded right-alignment, as I think this is probably a good idea.

Keyboard Maestro Wiki.kmmacros (22 KB)

Macro screenshot

3 Likes