Tutorial: Understanding When Drafts and Launch Center Pro Resolve Their Supported Tags

As you are experimenting with your own custom URL actions, you might encounter things that fail to meet your expectation. Sometimes we may be asking too much from either Drafts or Launch Center Pro, but other times we may just have a slight misunderstanding at how they are processing our URL actions. For example, both Drafts and Launch Center Pro have a special set of supported tags that they can help translate for us, but knowing when these tags are being resolved is crucial to ensure that the URL is working as we expect them to.


To illustrate my point, I will use the new [[clipboard]] tag in Drafts 3.0.

Let's say I want to take the current contents of the clipboard, modify it in a certain way, and put the new contents back to the clipboard, overriding the old one. Here's an example of the action I created in Drafts to prepend the current [[draft]] into the clipboard.


But, what if I want to put the new contents of the clipboard into a new Drafts post? The most obvious way is to create an action like this:


Yet, when you run the new action, you will be surprised to see that the new Drafts post contains only the old clipboard contents. This is because Drafts translates all of its tags, including the tags inside its x-success parameter, before it executes the URL. Thus the second [[clipboard]] tag will translate into the old clipboard contents, before the prepend action can be executed to modify the clipboard contents.

We need a way to delay the second [[clipboard]] tag from being resolved by Drafts too soon. We want it to be translated just after we have executed the first action. The only way to achieve this is to use the [[clipboard]] tag in a separate action that will be triggered after the first action has been executed.

Here's an action that I named New from Clipboard:


Open this link if you want it installed on your iOS device automatically.

Then, I modify my previous Prepend to Clipboard action to invoke this simple action, instead of writing the [[clipboard]] tag inside the x-success parameter.


Open this link if you want it installed on your iOS device automatically.

This diagram shows how the actions are manipulating the clipboard contents in the background involving four Drafts post.

If you pay attention to the URL above, I created a dummy post with text=anything and immediately replaced it with the new post from New from Clipboard action. This step is necessary because we need to have at least one character in a Drafts post before we could trigger any of its actions.

Launch Center Pro

Launch Center Pro exhibits a similar behaviour with its tag translation timing. To illustrate my point, I will take this opportunity to upgrade my previous workflow: Encode URL. I used one of the new Clipboard Action features in Launch Center Pro 1.1 to convert the current clipboard contents into its encoded version and puts it back into the clipboard.

The workflow starts by taking the current [[draft]] content in Drafts and returns to Drafts, but it doesn't create a new Drafts post containing the updated clipboard contents. Today, I will extend it and have it create a new Drafts post with the newly encoded URL pasted from the clipboard.

Similar to Drafts, the [clipboard] tag in Launch Center Pro is translated before the entire action is executed. Hence, the following action will not create a new Drafts post with the encoded URL, rather the new post will contain the old clipboard contents:


To delay the [clipboard] tag from resolving too soon, I have the action invoke the New from Clipboard action instead.


I have this action set up in Drafts, under the name of URLEncode. Open this link if you want it installed on your iOS device automatically.

This diagram shows how the actions are encoding the current Drafts post using a Launch Center Pro's Clipboard Action in the background.

Then, I create a new action named New Encoded Draft to take the current [[draft]] and put into the clipboard, before invoking the URLEncode action, and ending up with a new Drafts post containing the encoded URL:


Open this link if you want it installed on your iOS device automatically.


Both Drafts and Launch Center Pro are translating their supported tags once, i.e. as they parse the URL and before executing any chain of actions. Thus, if you have a specific tag that you want to resolve after the first action is executed, you should encapsulate that tag in a separate named action (in Drafts), allowing Drafts to parse and resolve it just in time: before executing the next set of actions.

By understanding the timing of tags resolution, I hope it can help to reduce the problems that you may have when designing your own custom URL actions.

To find my other workflows and tutorials, please visit my Productivity and Workflows blog.