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.