Trello this with Keyboard Maestro

October 06, 2014
Updated on: October 12, 2014 at 16:10

Trello this with Keyboard Maestro → via @_patrickwelker

Today I’m publishing my Trello macro for swiftly filing notes or websites to Trello. I’m actually a bit excited about it because it has been really useful so far for me.

If you work in a team and don’t know about Trello, go and check it out now. It shines at collaboration and their iOS app was the first one1 (that I know of) which implemented drag and drop in a elegant manner. It’s one of those services where you wonder why their free plan is so damn good. If your still not convinced let me play the power card: It has Markdown support.

What The Macro Does?

This Keyboard Maestro Macro will enable you to post to any Trello list on any Trello board by prompting you to select a board and list.

You can drag and drop a note from Finder to the droplet that comes with the macro. The first line will become the title (any Markdown header from # to ###### gets stripped) and the body renders as the description of the card.

Beside the droplet app there is a macro which works the same way, only it acts on a text selection.

2014-10-06-trello-this-note.gif

Another one will try to guess the active (aka frontmost) browser and takes the title of the active tab as the cards name and puts Source: <URL> in the cards description. Since there’s also a prompt you can change the cards name and description to your liking.

2014-10-06-trello-this-website.gif

You can cancel the transmission process on every prompt and the macro should fail gracefully, deleting all variables and stopping the rest of the macro from firing unwanted information at Trello.

Lastly, you can also copy a numbered Markdown list into your clipboard of a specific list:2

2014-10-06-trello-md-list.png

As I tend to write more modular macros recently, you should be fine modifying this to your needs by looking at the existing macros. I also put enough comments inside the macros to explain what happens in each step.

To get you up and running follow all the steps outlined in this post.

Dependencies

Behind the scenes my macro uses Brett Weavnet’s trello_cli. You have to install it via gem install trello_cli in Terminal.app.

Thankfully Brett’s documentation is very detailed and you should be able to accomplish the mission even if you only know ‘the shell’ from Mario Kart or Discworld.

Head over to the GitHub repository and follow his instructions. Here’s the gist of it:

Sign-in to trello.com as the user you want to use for trello_cli.

Get API key (open this link in a web browser):

https://trello.com/1/appKey/generate

The top field contains your Developer API Key. Use it to replace YOUR_API_KEY in the member token links below as well as the TRELLO_DEVELOPER_PUBLIC_KEY environment variable.

Next, get a member token. You will need to replace YOUR_API_KEY in the links below with the API key obtained in the previous step.

To get a read / write member token:

https://trello.com/1/authorize?key=YOUR_API_KEY&name=trello-cli&expiration=never&response_type=token&scope=read,write

In case you want to use his Ruby gem on the command line to also do the last step of the instructions on the projects GitHub site, namely “set the api key and member token environment variables”.

If you want to learn more about Token creation and so on, you can pay the official Trello documentation a visit.

DOWNLOAD

UPDATE: This macro now also contains the Markdown export macros from the follow-up post.

NOTE: Check via Terminal.app that your installed trello_cli gem is globally accessible (= accessible form anywhere without cd-ing into the folder where it’s located). The best thing is to symlink it to your /usr/local/bin/ folder.

To put a symlink there:

(1) Go to Terminal.app and type trello. Copy the path of your gem. Example output:

/Users/patrick/.rvm/gems/ruby-2.0.0-p451/bin/trello

(2) In Terminal.app make the symlink with ln -s source-path target-path. Example input:

ln -s /Users/patrick/.rvm/gems/ruby-2.0.0-p451/bin/trello /usr/local/bin/trello

If you type trello in Terminal.app and get a response you’re good to go.

Attribution

My thanks go to Brett Weavnet (@brettweavnet) for his trello_cli. I build this macro around his Ruby gem, so without it there would be no TRELLO THIS!

GitHub: https://github.com/brettweavnet/trello_cli

In addition, Rob Threw (@complexpoint) isn’t a FoldingText users lifesaver, he has a nifty snippet to make sure your Keyboard Maestro (or Alfred or LaunchBar or Hazel) installation uses the default shell:

Calling the FoldingText Command Line interface from KeyBoard Maestro

It’s way better than what I did before and thanks to it every one of you should have no problems running Brett’s Ruby Hem – so this is what I used in the macro to make trello_cli run properly without exporting additional RVM paths.

The droplet contains 99% of Evan Mullins (@circlecube) “Copy Path script droplet” AppleScript and a tiny bit of Keyboard Maestro to make it work. Oldie but goldie.

Know Issues

Standard Markdown should work just fine, but if your text starts with tons of hyphens there’s a good chance the macro will fail. The macro will convert every list that uses hyphens into an asterisks list, but there could be scenarios, like a text with --------- in it where the whole grummy thing chokes.

In case you find anything else, shoot me a mail.

  • blangel/wrk – This looked a bit dated and there are tons of issues with Umlauts; that’s why I dismissed it.
  • timcosgrove/trelli – This sounds promising. I haven’t checked it out since there’s no documentation aside from this post by Tim. UPDATE: Tim has abandoned the project.
  • mheap/trello-cli – I often write macros with YOU in mind (yep, this is ought to sound creepy), and since getting NPM to run is an extra step I went for the ruby version of Brett, since OS X supports Ruby out of the box. I haven’t installed this one either.
  1. Transmit iOS also pulls this trick of, but it was definitely not the first app to support drag and drop.

  2. I wish the macro would also add the description of the individual tasks, but trello_cli will only output the one line… and this is the actual title of the card. If you know how to pull it of or have another CLI tool that does the job send me tweet – I’d love to have/build a working Trello List to Markdown export.

comments powered by Disqus

Related Posts