Chaining Three TextTool Transformations Together with X-Callback-URL

Tweet This Post

I wrote the above Launch Center Pro action over the weekend. I thought it would take 15 minutes, but it took 45, because the encoding was such a challenge.

The Problem I Wanted to Solve

When I add new list items to an LCP action using the list tag, I sometimes just randomly add an item after the first pipe (|) I can find. Then I notice that the order of my list items has no rhyme or reason to it, so I want to alphabetize it. This is not an easy task, cut-and-pasting in a small text area on an iPhone screen. So I decided to use TextTool to automate the process for me.

  1. Remove the pipes in a sequence like Apples|Pears|Bananas using the split method.

  2. Use the sort method to alphabetize the list

  3. Add the pipes again between each item, using the join method.

Here is the full LCP action (click on the link in the Twitter embed above to install):

texttool://x-callback-url/transform?text=[clipboard]&method=split&delimiter=%7C&x-success=texttool%3A%2F%2Fx-callback-url%2Ftransform%3Ftext%3D%5B%5Boutput%5D%5D%26method%3Dsort%26x-success%3Dtexttool%253A%252F%252Fx-callback-url%252Ftransform%253Ftext%253D%25255B%25255Boutput%25255D%25255D%2526method%253Djoin%2526delimiter%253D%25257C

The sort transformation, URL-decoded:

texttool://x-callback-url/transform?text=[[output]]&method=sort

The join transformation, URL-decoded twice:

texttool://x-callback-url/transform?text=%5B%5Boutput%5D%5D&method=join&delimiter=%7C

Notice how, even though this action was URL-encoded twice after the second x-success parameter, the [[output]] had to be encoded yet again before the entire action was URL-encoded twice. I had to add an extra %25 before each double-encoded bracket to make the complete action work.

Related: Take a Photo, Get a Markdown Image Link with Launch Center Pro, Clean Links, and TextTool

Resources: TextTool x-callback-url Support page


Last built: Mon, May 12, 2014 at 8:52 AM

By Jeffrey Kishner, Monday, February 3, 2014 at 10:33 AM.