The URL Creation Workflow

The first action I've created using the new Launch Center Pro 1.1 update is actually an action to aid in the process of writing actions. In fact, I've put together an entire new workflow, which I'm now using to create all of my URL actions. It utilizes Text Expander, Drafts and Launch Center Pro to make writing URL actions much more intuitive and easy.

First, I set up a series of Text Expander snippets so that I can type quick shortcuts and have them expand into the complicated pieces that make up URL actions. Here are the shortcuts I've created so far, and keep in mind that this is still a work in progress, and I will be adding more and maybe removing some of these in the future:

  • "dBase" => "drafts://x-callback-url/create?text="
  • "dTitle" => "[[title]]&action="
  • "dDraft" => "[[draft]]&action="
  • "dBody" => "[[body]]&action="
  • "xCall" => "x-callback-url/"
  • "dAct" => "&action="
  • "xSuc => "&x-success="
  • "dBenc" => "{{drafts://x-callback-url/create?text="

As you can see, the first one, dBase, will expand into the beginning of any Drafts URL action: "drafts://x-callback-url/create?text=". This means that instead of typing that whole thing out and continuously switching back and forth between the "ABC" keyboard, the ".?123" keyboard, and even the "#+=" keyboard (to reach the "=" sign at the end), you just type "dBase", and it all pops up for you. Same thing with the rest of the shortcuts. Depending on whether you want to use the text of the entire draft, only the title, or only the body in your action, you will choose either "dDraft", "dTitle", or "dBody" to have it expand into the corresponding variable. Since "&action=" will always follow whichever of those is chosen, I added it to the back so you can skip that step, too. The "xCall" and "dAct" shortcuts are less useful, since they are both included already in the first parts of your URL, but I made shortcuts for them too in case you use them in the custom section of your URL, for the actions that Drafts will call. "xSuc" is theoretically useful, but in practice it will always come directly after the end of a word in your previous action, and therefore the snippet will not expand unless you hit a space first (but then you have to tap back to the start to get rid of the space). This renders it half useless, because I can type it out almost as fast, so I'm not currently using that one much. Finally, "dBenc" stands for "dBase encoded", and is the same as dBase except that it starts with "{{", so that Drafts will automatically encode it for you when you run your action. This is used when you chain a Drafts action to another Drafts action, because the second level action needs to be encoded in order to be read properly.

So, using this workflow, in order to create a complex Drafts URL action, I now need only type (for example)...

dBasedDraft{{name of action}}&x-success=dBencdDraft[encoded name of second action]}} substitute of having to type...

drafts://x-callback-url/create?text=[[draft]]&action={{name of action}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=[encoded name of second action]}}

A lot easier, no? But one last major annoyance: we still have to URL encode the name of the second action, which could be really annoying depending on how complex it is. Luckily, we can use Launch Center Pro 1.1 to do this extremely quickly.

The URL Encode Action

I created a Drafts action which utilizes LCP 1.1's clipboard and callback capabilities. To begin, type out as much of your URL as you need until you get to the point that needs to be encoded. When you reach that point, type out the unencoded URL, then select it and tap "Cut". The URL will be cut out of your Draft, but copied to the clipboard. Now open the Share menu and run the "encodeURL" action. Drafts will launch Launch Center Pro, where the URL on your clipboard will be encoded, then it will call back to Drafts and create a new Draft with as much of your URL as you have already typed. Tap the end of the URL and hit paste and the now encoded URL or name for the action you are calling is pasted to the end. You can continue typing out the rest of your action right away. The whole process takes a few second to do what used to take quite some time.

Here's a short video that I recorded of my iPhone completing this action sequence. Ignore the fact that I'm just recording my iPhone with my iPad, I don't have $99 to blow on ScreenFlow right now.

Direct Import Link

Bringing It All Together

So, returning to where we left off in the workflow, all you do is type in your URL action using the Text Expander Shortcuts that you will have created. Then when you reach the end and need to encode the final part of your URL, the second action to call, you type it out normally, then select it and cut it out of the draft, open the share menu and run "encodeURL", and when the action completes a few seconds later, you just type the final "}}" to complete your newly formed URL action! I have been using this process in my own experiments the last couple days, and I can attest to the fact that it is a far faster and more intuitive way to complete the usually painfully slow and meticulous process of typing up a URL action on an iPhone or iPad.

Not Fast Enough For You?

Despite the great increase in speed provided by typing up URL actions using Text Expander snippets, I wasn't quite satisfied. I realized that the process could actually be sped up even more using Launch Center Pro 1.1's new ability to place TE snippets inside of URLs. So I created a new action in LCP which essentially creates a Drafts template for complicated URL action chains. Here's the URL:


Running this action in LCP will prompt you for the action you want to have in the first "&action" slot, then create a new draft in Drafts with the new URL action prewritten and whatever action you typed inside of {{curly brackets}}. You just need to encode the second action (which is easy with the URL Encode action) and import your completed URL. (Which is also easy with my URL import action.)

Here's a video showing how much faster it is: (again, sorry the video is done so stupidly.)

There's no direct import link for LCP actions, but copy and paste the code above into a custom LCP action, and make sure you have all the same Text Expander snippets created as I do, and it should work perfectly. You should also note that the above code always creates a Drafts action using text=[[draft]]. If you want to use [[body]] or [[title]], don't forget to double tap "draft" inside the brackets, and change it to the one you want.

The End

So there you have it, the new workflow I'm using to create Drafts URL actions using Drafts, Launch Center Pro 1.1 and Text Expander Touch. Feel free to make use of it yourself, but if you make any cool actions with it, don't forget to send them to me.

Post to ADN