Bottom Line: Create more intricate LCP actions by using lists that run totally different URL actions.

As much as anything, the purpose of this post is to celebrate my discovery of philgr.com, where Phillip Gruneich has some incredible posts detailing impressively rich and complex x-callback-url based workflows for iOS. His workflows center on the usual suspects: Launch Center Pro, Drafts, and one I haven’t bought (yet): TextTool.

The most important thing I learned from browsing his blog the other night was how to launch different LCP actions based on selection from a list. This had been driving me nuts, because I was sure there would be a way… for example, to prompt for a search query, then choose from a list which search engine to use (perhaps Google in Chrome vs Google in Safari vs Wolfram Alpha vs other).

The answer lies in getting LCP to call itself by using a pattern like:

launch://?url=[[list:List Title|Option1=url1%3A%2F%2Furl1stuff%2Fhere|Option2=url2%3A%2F%2Furl2stuff%2Fhere]]

Let’s break it down piece by piece.

  • launch://?url= Call LCP and tell it to run the following URL
  • [[ Double brackets mean “don’t try to url-encode this stuff” — stopping LCP from doing what is normally helpful, but screw stuff up with these more complicated URL schemes are deprecated as of LCP 2.3.1
  • list:List Title Make a list with title List Title
  • | Very important — separates components of the list, like title from options, and one option from another
  • Option1= The title of the first option, with the = denoting that everything afterward and up to the next | is the value of that option
  • url1%3A%2F%2Furl1stuff%2Fhere This is just an already URL encoded version of url1://url1stuff/here, or in other words where you’d put your drafts://x-callback-url/create?text=some%20text&action=some%20action

  • Option2=url2%3A%2F%2Furl2stuff%2Fhere]] Should hopefully make sense by now

Go browse around philgr.com (and macstories of course) for countless examples of how this pattern can be put to use. Of course something that might just help you along the way is a quick and easy way to URL encode and decode… so not to get too meta but here is my first useful URL scheme I’ve created with this pattern. It’s all LCP, no other apps required. It

  1. prompts the user for input text
  2. prompts to choose either URL encode or decode
  3. copies the resulting text to the clipboard

Download to your iOS device