Playing with URLs in Launch Center Pro 2.3

This morning, I found myself wanting to clean a URL with Clean Links and then send the cleaned URL to another Launch Center Pro (LCP) action. You can chain LCP actions together now using the [action:##] tag that was introduced in LCP 2.3. This wasn’t as straight-forward as I had hoped it would be, but the solution I came up with works really well. I’d love to see if there’s a simpler implementation.

The workflow looks like this:

  • Copy URL
  • Open LCP and fire the clean-link action
  • Clean Links strips the cruft out of the URL, places it on the clipboard, and returns to LCP
  • LCP then calls another action to do further processing on the contents of the clipboard

Here’s what the resulting LCP action looks like:

clean-links://x-callback-url/clean?url=[clipboard]&x-success={{launch://x-callback-url/clipboard/?text=[clipboard]&x-success=[action:10]}}

First, we pass the URL on the clipboard to Clean Links. It passes back the cleaned URL on the clipboard and returns to LCP via the x-success parameter.

From there—and this is where it gets hacky—we tell LCP to call an internal function (/clipboard/) to place the current contents of the clipboard onto the clipboard. This is necessary so we can then use the x-success parameter to call action number 10, which is what we’re really after.

Again, very hacky, but if you need to do something like this, it works really beautifully. If theres a better way to do it, I’d love to hear about it (@jeffmueller on Twitter and App.net).

Update: Here’s a much simpler version:

clean-links://x-callback-url/clean?url=[clipboard]&x-success={{launch://?url=[-action:10]}}

Thanks to Eric Pramono for the tip!