The Import Actions Action Sequence

If any of you have tried to run my old Batch Import action since Drafts 3.5 was released (or any other recursive actions which previously looped inside of Drafts until an error occurred when they ran into a blank draft), you will probably have run into the annoying problem of facing an infinite loop of Drafts attempting to import a blank draft, failing to do so, and trying again anyways. Stopping the loop required exiting the app via the home button (or a five finger pinch on the iPad), then opening the multitasking menu and force quitting Drafts. You could try to do it by going straight to the multitasking menu from Drafts, but unless you move really, really quickly, Drafts will force close the multitasking menu instead of it force closing Drafts. This issue was caused because of a new feature in Drafts 3.5 which allowed you to run actions on blank drafts. Overall, this feature is a great addition, as it makes a number of other new options possible, but as a result, we'll need to find a new work around for our now problematic looping actions. I spent a while debating how to get around this issue so that Batch Import, and other recursive actions, could work again, and I have finally reached what I think is an acceptable solution. It requires a tiny bit of extra work, but it's worth it to allow recursive actions to function again.

My solution will require a whole new set of actions for the Batch Import sequence, so feel free to throw your old ones away if you still have them. Basically, it works by adding an extra line of text onto the end of each set of two code lines which define an action and its URL. This third line will specify the title of the next action to run on your list. For importing URL actions, we still use the first action I ever added to The Action Page: The importURL action. This action uses Drafts' built in "/import_action?" URL scheme to take the first two lines of a draft and import them as a new URL action. Here's the code for importURL:


Pretty straight forward, importURL uses the first line of your draft as the title of the new action to import, and the second line as the URL. The Import Actions action, just like the old Batch Import action, will chop the first two lines out of your list of actions, call importURL to import them as a new action, and then pull the rest of your list into the next action sequence via its x-success parameter. However, there's one final caveat in the new action sequence. Whereas the old sequence would chain back to itself automatically, importing the next set of actions without any further direction, the new sequence's x-success action is not hard coded. Instead, the x-success action is defined as [[line|4]], the forth line in your list of actions. Here's the code to check out if that's not clear:


So this action takes the first two lines of your draft and runs importURL on them. Then it makes a new draft using the fifth and further lines from your first draft, and runs an action on the new draft defined by line 4 in the old draft. This method solves the issue with an infinite loop because the last item in your list of actions will not have a forth line, so Drafts will not even attempt to run another action after importing the final action in your list. Not only does this fix the infinite looping issue, but it also gives the entire sequence a more graceful end by not causing an error to occur, which you then have to dismiss, after it finishes importing everything. If you're not quite sure how this would look, here's an example of the code you might have in a draft that you run this on:

Cross Post
drafts://x-callback-url/create?text=[[draft]]&action={{Post to}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Tweet%3A%20the_axx}}

Import Actions
Triple Cross Post
drafts://x-callback-url/create?text=[[draft]]&action={{Post to Facebook}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Cross%20Post}}

Import Actions
Quadruple Cross Post
drafts://x-callback-url/create?text=[[draft]]&action={{Cross Post}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Post%20to%20FB%20and%20G%2B}}

If you run Import Actions on this sequence, it will first import the Cross Post action using the first two lines (a line is defined as everything before a line break, so even if your code wraps to the next line, as long as you don't have a newline in the middle of it, it will be treated as one line.), then create a new draft using line 5 and every line after (so the new draft created will start with the line reading "Triple Cross Post") and finally it will run the action defined by line 4. Since line 4 says "Import Actions", it will call back to itself and run again. This time, it will import Triple Cross Post, create a new draft starting with "Quadruple Cross Post", and chain back to itself again. Finally, Quadruple Cross Post will be imported. This time, however, since there are no further lines, Drafts will create a new blank draft and, since there is no fourth line after the Quadruple Cross Post action, it will not even attempt to run an action on it. The sequence will end and your actions will be imported.

One final note, if you currently use the importURL action for importing new actions, keep in mind that this sequence will work perfectly fine on a singular action title and URL that you want to import, so you can keep the clutter down by hiding the importURL action from your action lists and just using "Import Actions" for all URL importing purposes.

Below are direct import links for the two necessary actions. If you already have the old importURL action installed, it hasn't changed at all, so as long as you haven't changed the name or the code, it will still work fine.

Direct Import Link for importURL action.

Direct Import Link for Import Actions action.

Quadruple Cross Post

When I first posted my Triple Cross Post action, which posted a draft to, Twitter and Facebook, I had multiple requests for an action that added a fourth option: posting to Google+. At the time I was unable to figure out how to get that to work, since Google+ was not a supported action in Drafts. As of Drafts 3.5, however, it now is. So, finally, for those of you who do want to post to all four of those networks, here's that action sequence you asked for:

The Quadruple Cross Post action itself first runs the original Cross Post action to post your draft to, then Twitter. Next, it chains back with x-success to then run the new Post to FB and G+ action, posting your draft to Facebook and Google+. Here are the actions:

Quadruple Cross Post

drafts://x-callback-url/create?text=[[draft]]&action={{Cross Post}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Post%20to%20FB%20and%20G%2B}}

Cross Post

drafts://x-callback-url/create?text=[[draft]]&action={{Post to}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Tweet%3A%20the_axx}}

Post to FB and G+

drafts://x-callback-url/create?text=[[draft]]&action={{Post to Facebook}}&x-success={{drafts://x-callback-url/create?text=[[draft]]&action=Post%20to%20Google%2B}}

Direct Import Link for Quadruple Cross Post

Direct Import Link for Cross Post

Direct Import Link for Post to FB and G+

Note: If you already have Cross Post installed from the original version, just make sure it is named in the new form "Cross Post" instead of the old "crossPost" for this action to work. That or change the code in the Quadruple Cross Post action to "crossPost". I changed it for better readability, having it in the no-space, lowercase-first-letter format didn't really have a purpose.

The Fantastical Batch Parse Action

A simple, fairly self explanatory action sequence to take a draft of a list of items to be parsed in Fantastical and send them over for parsing one by one. The list can have blank lines between each item, or no lines separating, it makes no difference as long as there is a line break after each item to be parsed. This is a simple action, yet very powerful, as it automates the previously slow and monotonous task of adding multiple event at once to Fantastical, or any calendar app. Just type up each event, with date as well, in natural language in a list in Drafts, then run the Parse List in Fantastical action and enjoy yourself as each event is added one after the other.

Direct Import Link for Parse List in Fantastical Action

Drafts 3.0.6 and Batch Import Action Groups

An extraordinary new way to batch import an unlimited amount of actions into your Drafts action library automatically. This action sequence creates huge new possibilities for sharing complex actions among advanced Drafts users, or even giving out a basic starter pack of actions for new beginners.

Many of the coming action sequences on The Axx will be released only in Batch Import format, so make sure you grab these four actions so you can continue to enjoy actions from The Axx!

Direct import links for the Batch Import actions:

Batch Import




For anyone interested in testing them out, or who wants some of the actions listed, here are a few action groups I've created. Just don't forget that 


The Custom Actions Action Sequence.

This action sequence utilizes the method I designed for "chopping" a draft, as well as, optionally, the new fill-in snippet capabilities of Text Expander Touch 2.0, to allow you designate any two actions from your action list and perform both of them on a draft, without having to first build a specific chained action for each particular combination.