Bottom Line: Editing Launch Center Pro URL schemes on your iDevice can be a bit of a pain, so here’s a way to do it on your MacBook (in json).
I’ve made a fair number of posts on Launch Center Pro — I love it. It’s a great app that I use both in my personal life as well as at work. I can’t begin to tell you about how many uses it has, except to say that if you’re into automation and consider yourself an iOS power user, you owe it to yourself to give LCP a shot.
In their recent 2.3.1 update, they made composing complex URL schemes much simpler and much more readable. Unfortunately, the change also broke a few of my URL schemes, so I spent some time writing a few scripts to help me fix them. These take advantage of LCP’s in-app Dropbox backup, which creates a binary plist in the form of a
.lcpbackup file. The cooler script is at the bottom, so scroll down if you’re impatient.
Before you use any of these, use LCP’s in-app backup to make a few extra copies of your current setup, so you can restore to them if needed. As long as you have a backup you probably will be able to get back to where you started even if something screws up, but I can’t guarantee it.
The first script I wrote, lcp_unquote.py, just undoes URL encoding. The LCP 2.3.1 update makes much of the manual double or triple URL encoding I used to do unnecessary, and since it’s virtually unreadable in that form, this just tries to change everything back. Note that it takes an
.lcpbackup file as an argument, e.g.
cd /path/to/lcp_backup_folder python3 /path/to/lcp_unquote.py file.lcpbackup
The URL schemes in the resulting file will probably still not work, but its URL schemes will be much more readable, so you can import it back into Launch Center Pro and manually edit your now readable URL schemes.
I’m pretty excited about the second script, although it’s still fairly hackish and amateur. With the
-read flag, lcp_export.py takes an
.lcpbackup file as an argument, strips out the URL schemes, then exports then to a
.json file. This
.json file can be opened in your favorite text editor and changed however you like with the convenience of a full-size keyboard and a full-size screen. You can change the URL names and URL scheme contents, but don’t change the URL IDs.
-read flag also exports a copy of the
.lcpbackup converted to XML format, which can also be opened in a text editor. The rest of the script depends in part on the XML formatted
.lcpbackup file, so don’t change it — not even the name. Make a copy if you want to mess around.
Then with the
-write flag, it takes your modified
.json file as an argument, uses the XML formatted
.lcpbackup file as a template, and inserts these values into a new binary-formatted
.lcpbackup file, ready to be opened in your iOS device.
Again, probably easiest to use as such:
cd /path/to/lcp_backup_folder python3 /path/to/lcp_export.py -read file.lcpbackup vim output_file.json python3 /path/to/lcp_export.py -write modified_file.json
For the command line novices out there, you’ll obviously need to change placeholders like
output_file.json, and input the correct values for your individual setup. And if you don’t know how to get python3 (check if installed with
which python3), I recommend you check out HomeBrew.
Okay, I’m pooped. Please submit issues in the comments section below. Feel free to modify and customize (though I do appreciate linkbacks / attribution). Hope this helps some of you out there!