Importing QuickCursor Keyboard Maestro Macro in XML

I was hunting for a QuickCursor replacement and after many dead ends I think I found a macro I’d like to try but I am not sure how to import it into Keyboard Maestro. When I click on the download link I get an XML plist file. @peternlewis perhaps this makes more sense to you. The download link is Here.

The original article appears Here

I also found this One

I like the way it was implemented using the single keyboard short for all the variations but there are too many choices so what I want to do is come up with something I can use to choose between a couple of editors such as @DanThomas 's favorite Atom and @ccstone 's favorite Tex-Edit. I like the way he packaged the macros too. I thought it was a novel way to compile the collection.

As far as the XML file is concerned, just save the link to disk. It should end up being called “Edit in BBEdit.kmmacros”. Then just double-click it to import it into KM.

If you need help from there, just ask, but I suspect that’s all you need.

Nope. That's what I thought but saving it gave me "Edit in BBEdit.kmmacros.xml"
The header looks like a plist header so I am guessing it's got to be placed somewhere that plist files for Keyboard Maestro should go. I am thinking that Keyboard Maestro probably saves all the macros we create as a plist somewhere. The question is where?

Here's the header:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">

It is definitely a .kmmacros file. When I saved it as BBEdit.kmmacros, it imported into KM just fine. So all you have to do is change the file name.

I wonder why he saved it as an xml file?

My guess is that the browser saved it that way automatically. It is technically an XML file, after all.

Dan I tried the script but it appears to be fetching BBedit from /usr/local/bin/bbedit
I thought I could edit the path to use Tex-Edit Plus or TextMate (or some other editor) but the other apps aren’t located in /usr/local/bin/bbedit

I could probably do it by fetching the app from /Applications but he’s using a shell script to do the dirty work. The shell script is:

#!/bin/bash TSTAMP=date “+%Y%m%d-%H%M%S”`
TEMPFILE="$HOME/Desktop/$TSTAMP-BBTMP.txt"

pbpaste > “$TEMPFILE”
/usr/local/bin/bbedit --wait “$TEMPFILE”

cat “$TEMPFILE” | pbcopy
mv “$TEMPFILE” $HOME/.Trash/`

I assume he’s doing this because he’s using the shell to get his date, create a file on the desktop, insert the paste, then move it into BBedit and toss the temp file into the trash.

I was hoping to be able to setup a list of text editors I could choose after the copy and the shortcut key was depressed so I could choose the editor. This would make it easy for me to test Atom and Sublime as well. Is there another way? I must admit his macro is pretty tight code.

I’m probably not the one to ask about that. Perhaps @ccstone can help.

Can’t you do that in the second macro you have linked to in your initial post? (“I also found this One”)

If you are referring to the second macro, you could simply disable the unwanted sub macros and add your own editors.

Yes but I like the one with the shell script better. :slight_smile:

Hey John,

Nyet...

$> indicates the beginning of your command-line (do NOT include it in commands you run in the Terminal).

$>which bbedit

Result:

/usr/local/bin/bbedit

Reveal it in the Finder:

$>open -R /usr/local/bin/bbedit

This is the bbedit command-line tool that comes with BBEdit – NOT BBEdit itself.

TextWrangler has a similar one called edit.

The following command is very specific and cannot simply be replaced with any old editor.

/usr/local/bin/bbedit --wait "$TEMPFILE"

By using the --wait switch the shell script employing it is paused until the document being edited in BBEdit is closed and then allowed to continue.

This allows you to edit something in BBEdit and then shoot the result to something else when the document is closed.

-Chris

Hi Chris, loved the “Nyet!”

Ok I dig. The Text Wrangler command line tool sounds interesting. But I must admit the macro looks very powerful the way he set it up. Perhaps I’ll download the BBEdit demo and try it because as you know, we all want to spend more money on more programs. LOL.

This lead me to consider the PDF handling app you mentioned a while back. One of the modules I thought I wouldn’t use is now looking pretty interesting. It’s the one that converted PDFs back to text. Using the technique he used where he was managing the text in the shell then pasting it back and killing the temp file was beautiful. Powerful stuff. I’ve got to dig in deeper.

Hey John,

Keep in mind that TextWrangler is the freeware version of BBEdit and simply lacks some of BBEdit's more powerful tools. In this particular case I think TextWrangler would replace BBEdit without issue.

But. If you're going to continue to play with shell script then you want BBEdit and its Shell Worksheets (amongst other power features).

BBEdit is also muy scriptable.

-Chris

I think they have changed the demo/trial policy recently, so that you can continue to use BBEdit after the trial period:

http://www.barebones.com/products/bbedit/demo.html:

At the end of the 30-day evaluation period, BBEdit will remain permanently functional with a revised feature set that includes its powerful text editing capabilities but not its web authoring tools or other exclusive features.

It’s not clear if that “revised feature set” is equivalent to TextWrangler’s, or inferior or superior.

Hey Tom,

Thanks – I didn't realize that had gone public...

At some point all development of TextWrangler will stop, and the non-registered version of BBEdit will revert to a TextWrangler-Plus feature-set at the end of the trial period. This will save the developers a lot of work.

There is a clear comparison of the feature differences between BBEdit-Registered, TextWrangler, and BBEdit-Unregistered.

http://www.barebones.com/products/bbedit/comparison.html

-Chris

Hi Chris, thanks for the comparison link. According to that it’s pretty pointless for anybody to get TextWrangler.

At some point all development of TextWrangler will stop […] This will save the developers a lot of work.

Sure? TextWrangler still makes for a good teaser app on the MAS.

It's got a great RegEx tutorial. :wink: