Workflow (iOS): A Workflow to Duplicate Workflows

Late last year I was eagerly awaiting the release of a new iOS application that promised a new level of automation. Whilst I do like using Launch Center Pro, Drafts and Pythonista, Workflow promised something a little different and something that could complement these other tools nicely. I’m sure I’ll be sharing numerous workflows on this site as time goes by, but the first one I thought I’d share is one that you could say is a little bit meta. A workflow for duplicating workflows.

Version 1.0.1 of Workflow to be honest has some rather irksome bugs but it is still incredibly functional and shows huge near term potential. It has a fairly slick user interface, but at the same time it is missing some features that would make it easier to manage workflows such as folder segregation and duplication of workflows. For the latter however I have come up with a workflow that allows you to duplicate workflows.

How to use it

With the duplication workflow installed the first thing you need to do is open the Workflow app and select the workflow to duplicate.

Once opened locate the share option at the top of the screen and tap on it to reveal the Workflow share sheet. Here you should hopefully see the option on the bottom row to copy. If you don’t swipe to the right to show additional options. If it is still not listed you may need to select the more option and enable it. Once enabled you should of course select it.

Next open and run the duplication workflow. It will prompt you to enter a name for the new workflow.

Once the name has been entered and a few moments have passed, you should hear a notification noise as the workflow finishes. Tap on Done and you should now see the duplicated workflow has appeared with the new name and with an identical set of actions.

Being able to duplicate workflows enables you to not only produce workflows with slight variations much more quickly, but also to give you a handy backup while you experiment with enhancements to an existing workflow.

How it works

When selecting the Copy share option a URL is copied to the clipboard. This URL is to a page on the Workflow web site from which the workflow can be shared. The premise here is to take that page, get the installation link from it and use that to create a new instance of the workflow with a different name.

Rather than having to parse the content of the sharing page for the installation URL I noticed that (unsurprisingly) there was a direct correlation between the sharing page URL and the installation URL.

Detail Links
Install workflow://import-workflow/?

The key thing here is the ID found at the end of the first URL. If we know this ID, then it is relatively straight forward to generate the installation URL … up to the value of the ‘name’ parameter (“Make%20PDF” above), but we’ll come back to that in a moment.

The workflow begins by taking the clipboard contents and replacing “” with “workflow://import-workflow/?url=”. Note that the percent encoding isn’t necessary here as it will evaluate in this instance to the correct URL in the end - it just makes it a little easier to read when it isn’t encoded.

The resulting string is then held in the urlStart variable.

The next step is to ask the user for the name of their new (duplicated) workflow. Once entered, any spaces in the name are replaced by a percent encoded space (“%20). If we don’t do this any name with a space in it will only be named with the characters before the first space.

The urlStart variable is then concatenated with “.wflow&name=” and the new workflow name. We are effectively deducing the install URL but giving it a new import name.

The resulting URL is then opened which causes the Workflow app to import the workflow with the specified name, and then finally a notification sound is played to tell the user that the workflow has completed.

Here’s how it looks in the Workflow app:

If you are on an iOS device with the Workflow app installed, you can tap here to install the Workflow Duplication Workflow.

Author: Stephen Millard
Tags: | workflow | ios |

Buy me a coffeeBuy me a coffee

Related posts that you may also like to read