Undoubling redux

One of the nice things about blogging is learning from people who read what you did and show you a better way. This morning, Gabe Weatherhead, proprietor of Macdrifter, wrote a post that taught me a lot about Workflow and pointed me toward a simplification and improvement to my URL undoubling workflow.

My Workflow ignorance is vast. Although I bought it right after it appeared, I didn’t like programming in it and didn’t understand why anyone would. At the time, my only iOS device was an iPhone, and I didn’t realize how much different the environment was on an iPad, where you can actually see the list of actions at the same time you’re building up your workflow. Now I’m playing catch-up.

I learned two things from Gabe’s post:

  1. There’s an action, called View Content Graph, that lets you see all the information that can be extracted from whatever it is—URL, image, map, calendar event, etc.—you’re acting on. You can insert this at various points in your workflow as you’re building it to use as a debugging/exploration tool.
  2. The URL from the Washington Post app isn’t doubled within Workflow. In his post, Gabe showed the top level content graph for an item from the WaPo app, and the URL looked like it should. This wasn’t a complete surprise; as I said in my earlier post, the URL gets doubled when pasting it into some apps but not others. The doubling problem seems to come from some combination of the app you’re copying from, the app you’re pasting into, and some change Apple made in the underlying APIs that manage that interaction.

Armed with these two bits of information, I started exploring and quickly confirmed that the text manipulation action in my workflow—the regex substitution that eliminates the superfluous URL—was unnecessary.

WaPo URL workflow

In fact, it wasn’t doing anything at all because the URL it was being fed wasn’t doubled.

So here’s my stupidly simple new workflow, which I’ve named Copy URL Only for reasons we’ll discuss in a bit.

Copy URL Only workflow

For WaPo articles, this does the same job as my previous workflow because it sneaks around the doubling bug that comes from using the Copy item in the Share Sheet. And for those apps that like to take both the page title and the URL, this strips out the title, which I never want.

Gabe has a similar workflow that’s more general than mine. It grabs all the URLs on a page and presents them to you as a list so you can choose the one you want. Since I pretty much always want to link to the page I’m looking at, the choosing step would just slow me down.

So now I have a new (to me1) tool I can use when writing workflows, and I have simpler and better version of a particular workflow I use nearly every day. It’s good to have smart friends.

  1. I know Federico has written often about Workflow’s content graph, but I wasn’t paying attention because I hated programming in Workflow on my iPhone. I need to dig through the MacStories archives.