Fixing Recursive Workflows with the New allowEmpty Parameter in Drafts 3.5.4

A couple of days ago, Greg Pierce released a new update to Drafts. The 3.5.4 update has a quick fix for text encoding bug found in the previous update. What makes the previous 3.5.3 update a noteworthy one is the new allowEmpty=[YES/NO] parameter for executing incoming URLs.

Incoming URL is a way for Drafts and other apps to create a new draft, execute a named action, or import a new custom action in Drafts. I've been using it to perform recursive invocations on custom URL actions. My earliest example was adding multiple events in Fantastical, which dated back in April.

Unfortunately, the September's 3.5 update included a feature that conflicts with the recursive hacks I've been using. The new feature allows you to run actions on an empty draft, regardless whether it's manually triggered or triggered by an incoming URL. This forced me to come up with a workaround that removed the x-cancel parameter as the only way to stop the infinite loop when the other app doesn't prompt you whether you want to continue or not.

I've also come up with another workaround that uses a runtime value, instead of a predefined value, for the action parameter. This allows recursive actions that only involve Drafts to stop when it encounters a blank action name. It's great for triggering multiple built-in Drafts actions with a single draft, or for importing a batch of URL actions recursively.

The new allowEmpty=[YES/NO] parameter solves this recursive problem. Because most recursive invocations are incoming URLs, we can set the allowEmpty parameter to NO. This stops the recursive invocation whenever it encounters an empty draft. It also frees us to use x-cancel parameter the way we want to, whether we want to cancel and return, or cancel and continue.

The perfect example for this update is the first example that started this recursive hack in the first place: adding multiple events in Fantastical. It was Fantastical's 1.1.1 update with x-callback-url that started it all. And with the new Fantastical 2 released yesterday, it's only appropriate if I update it with the new fantastical2:// URL Scheme.

Open this link if you want it installed on your iOS device automatically. If you still want to use Fantastical 1.x instead, open this link to install the updated action with allowEmpty parameter.

Note: The new Fantastical 2 also allows you to add a reminder instead of an event. Just type in "task", "todo", "reminder", or "remind me to" as the prefix of the sentence. You don't need to create a specific action just to add reminders into Fantastical. You can use the same action to add a mix of events and reminders in any order you like.

I have also updated two other actions in my Drafts Action Directory: adding multiple reminders in Due, and adding Pomodoro tasks in Due. Both of them now use the new allowEmpty parameter.

Using OmniFocus Mail Drop service, you can create a Mail Action in Drafts that will automatically convert the first line into an email sent to your Mail Drop account.

Using Mail Action to Add Multiple Tasks to OmniFocus

Another workflow that many readers have requested me to write is adding multiple tasks into OmniFocus. While OmniFocus for iPhone doesn't support x-callback-url, OmniFocus as a service has a great mail drop feature. Simply create a Mail action that send the [[title]] as the email subject to your OmniFocus mailbox. Then, create a custom URL action that will execute the Mail action for each line in your [[draft]].

Open this link if you want to install the sample OmniFocus Mail Drop action on your iOS device automatically. You need to change the email address to match your mail drop account in the Mail Action menu. You might also want to turn off the "Send in Background" option to make sure that each email is sent right away.

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


The new allowEmpty parameter helps to solve the conflict that recursive hacks had to deal with since Drafts 3.5 update. As shown in the first clause of OmniFocus' example above, it can also be used in other non-recursive action if you want your action to work only if the [[draft]] is not empty. Thanks to Greg for his willingness to backtrack a bit on his brand new feature by adding this parameter to override the default behavior. I'm sure many would share my appreciation for it.

You should follow me on Twitter here.