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:
Let’s break it down piece by piece.
launch://?url=Call LCP and tell it to run the following URL
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 schemesare deprecated as of LCP 2.3.1
list:List TitleMake a
|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%2FhereThis is just an already URL encoded version of
url1://url1stuff/here, or in other words where you’d put your
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
- prompts the user for input text
- prompts to choose either URL encode or decode
- copies the resulting text to the clipboard