Mar
4
2014

Command-C Browser Actions

Posted by at

Command-C

When I'm writing on my iPad at home, there's a chance I have my MacBook on my desk with either iTunes open (to check for app updates or playing music from iTunes Match/Radio) or MailMate running (because I've been having issues with Mail on the beta of iOS 7.1). It's not uncommon for me to use a dual-monitor setup when writing, relying on my MacBook for Google searches and other reference material – effectively, I use it as a secondary display to my iPad when I'm working on articles that require a fair amount of research.

Since the release of Command-C, I've been using Danilo Torrisi's utility to quickly beam text and URLs across all my devices, using Launch Center Pro actions to speed up the process. Command-C has excellent support for URL schemes – a boon to iPad users who fiddle with automation tricks to save time when working on iOS. I recently realized, however, that most of the content I share with Command-C is made of URLs from Safari, therefore I asked myself whether I could put together a solution to send URLs with one click from Safari without using an external app or keyboard shortcut. It was pretty clear from the beginning that I would end up with a bookmarklet, but I have to thank Danilo for providing the necessary guidance I needed to achieve the kind of workflow I wanted.

The bookmarklet is part made for myself, part proof of concept (as always) for others to iterate upon. It doesn't only send URLs from Safari on another device with Command-C – it sends the webpage you're currently viewing in Safari to another app on another device with Command-C.

(more…)

Joseph Schmitt, writing in response to Greg Pierce's hack to simulate x-callback-url support in Chrome:

Wouldn't it be great if Safari supported Chrome's back button behavior? It sure would. However, Apple's laissez faire attitude towards inter-app communication keeps me from holding my breath on this front. Therefore, I was truly excited when I saw this post by the father of x-callback-url himself, Greg Pierce, wherein he launches a simple HTML page in Safari and uses JavaScript to add x-success links to the page on his own. Woah, awesome!

However, Greg's technique depends on loading a full-screen iframe on the page and overlaying a back button on top to trigger the x-success url. That gets the job done, but I really prefer how Chrome handles this: make the last page jump to the previous app. I brainstormed for a bit and figured I could probably replicate Chrome's behavior's using Greg's idea, and I was right: xsuc.es was born.

To build actions with xsuc.es, see the URL parameters in Joseph's blog post. The format is easy to understand if you're already familiar with URL schemes; here's a demo action to launch a Google search in Safari based on xsuc.es from Launch Center Pro.

xsuc.es is a nicer hack that takes over Safari's Back button to go back to a previous app like Chrome does, albeit without the app's name visible alongside the button. You can, however, tap & hold the back button to see the app you're going back to. It would be nice to mix a success URL scheme with the address of the webpage you're currently viewing, although I believe that's beyond the limit of how much it's possible to work around Safari's JavaScript.

Speaking of Greg Pierce, I'm intrigued by the workaround he found to mimic support for x-callback-url in Safari for iOS:

For those not familiar, it is possible to use x-callback-url support in Google Chrome on iOS to open a URL from another app, and have Chrome present a “Back” button to return to the app you opened the URL from. Safari does not offer this level of integration.

To mimic this feature in Safari, I have created an intermediate HTML page with a little javascript that can take a “url” and “x-success” parameter. If it gets these, it will load the “url” in an iframe that displays full screen, and present a “< Back” button in the top left of the screen, which when tapped will open the URL in the “x-success” parameter.

Here's what I did: I downloaded Greg's HTML file on my Mac, put it in my Public folder in Dropbox, and got the direct link that can be accessed by any web browser. With that, I edited the Drafts action Greg made and now I have a custom “callback page” that I can integrate with Safari and actions from Drafts, Launch Center Pro, Editorial, or Mr. Reader. I'm thinking of how I could take advantage of this solution in my workflows – the nice part: you can navigate across pages inside the frame – but I believe I will mostly use it to quickly check a webpage in Safari and go back to the previous app quickly.

It's an interesting workaround, but still a hack. For instance, it's not possible to dynamically generate a callback address from the address that's currently loaded in the frame. Still, if you want to put together a basic alternative to Chrome's excellent x-callback-URL support, check it out.

When Launch Center Pro 2.2 was released last month, I mentioned the addition of Dropbox actions for creating and modyfing text files, but I didn't share any action example because I couldn't find a possible use of the feature in my workflow. This morning, I realized that my old workflow to generate and share text files with Dropbox could be simplified with Launch Center Pro, so I rewrote it using the app's new Dropbox functionalities.

I often need to create text files and share them quickly with Dropbox. These are usually notes that don't fit in a Twitter DM or long crash reports for developers of apps I'm testing. In my old workflow, I used to type file name and file contents in Launch Center Pro, then, with two steps of inter-app communication, upload the file with Drafts, get the shareable link back with Launch Center Pro, and start a new tweet with the link in Tweetbot.

The workflow still gets the job done but the new version is simpler, faster, and more flexible. It's just three steps:

  • Type file name;
  • Type file contents;
  • Get public link to text file in Dropbox.

With a single action that doesn't involve switching between apps, I can type a file name in a Launch Center Pro prompt, insert contents manually or by pasting, and hit Done to create a text file in Dropbox. Launch Center Pro gets the link of the just-created file and presents an iOS share sheet with a series of options for the file's public link so that I'm not limited to Tweetbot anymore; I discovered that I often needed to DM or email a link, and with the old workflow I was forced to start a new tweet then select and copy the link manually from it. With the new action, everything happens inside Launch Center Pro in seconds and I can pick the best option for me (it's usually “Copy”).

I was skeptical as to whether I would need Dropbox actions in Launch Center Pro, but this workflow shows some clear benefits of Contrast's app – keyboard prompts and a native share sheet combined with Dropbox text features make for a quick and elegant note-taking and sharing experience.

You can download the action here.

Nice work (and great name) by Jeff Mueller: starting from my idea for an action menu for Safari in Launch Center Pro, he made a web app to simplify the process of assembling the bookmarklet. You can choose from a set of emojis for icons, select one of the built-in actions (so you don't have to write URL schemes), and hit Create Menu to generate a menu. It's very simple and much better than writing code manually.

I hope that Jeff will add more app actions and emojis soon. Check it out here.

Feb
4
2014

Launch Center Pro action menu

Last week, I was looking at the way I use Safari and save links to other apps and services, and I realized that I wanted a unified action menu to group some of my most used bookmarklets together. While this can be done by creating a bookmark folder in Safari, folders require too many taps on the iPhone and I’d like to have better visual differentiation between actions with unique icons for each one of them. That seemed like a good opportunity to test the capabilities of Launch Center Pro (now on the iPad as well) when it comes to lists and JavaScript, so I got to work.

A fair warning: Though my solution works, the code isn’t pretty. Until Apple improves the way apps can share information with each other, we’re stuck with hacks like URL schemes, JavaScript, and manual encoding. If you want to customize what I came up with, you’ll have to manually edit URL schemes and test everything on your own. If you’re not concerned about a bookmarklet’s prettiness, go ahead – I’m fairly satisfied with the results. (more…)

Jan
30
2014

Launch Center Pro

Contrast’s Launch Center Pro, the app that started the small revolution of iOS automation in June 2012, arrives today on the iPad with a new version (sold separately at $4.99) that takes everything you know about Launch Center Pro for iPhone and scales it up to the bigger screen. Launch Center Pro for iPad doesn’t do anything dramatically different from its iPhone counterpart: you can create custom actions, play around with Dropbox and clipboard integration, and do all the things that were possible in Launch Center Pro 2.1 – only now on your iPad too.

Finally.

(more…)

I started teaching myself how to build and run URL actions with Drafts in early 2013, when I decided to attempt to satisfy Federico Viticci’s Challenge to chain more iOS apps together than he had. I spent a few days feverishly searching for information on URL schemes, learning how to build actions and run them through the Drafts URL action engine, and figuring out the best way to create a chain which connected more than Federico’s record of three apps. When I triumphantly sat back and watched my iPad run an action sequence automatically chaining five apps together (Drafts, Dropbox, Due, Instapaper and Chrome), I had no idea that it would lead to an article being written about me here, starting a blog to have a place to write about the actions I was building, an opportunity to beta test Drafts, and the chance to connect with all kinds of interesting, like-minded people from all over the world.

Since that time, less than a year ago, iOS automation has exploded in power and popularity. It feels like a new app adds support for x-callback-url almost every week. Drafts still stands tall as one of the front runners in the field, having added awesome new features to make far more powerful workflows possible since last February, but other apps compete as well. Launch Center Pro and Pythonista are notable, and the latest challenger, Editorial for iPad, rode in on a blaze of Viticci-inspired glory. So much has changed since the beginning of last year, but there’s one important aspect which, surprisingly, has not. While the field of iOS automation has paraded forward, the gateway into the fun, learning the skills to understand and build the URL actions that make inter-app communication possible, has remained almost unchanged. Information is more readily available from the introduction of many new sources, but it remains scattered and decentralized. The inner workings of URL schemes are not incredibly complex, but when interested individuals must spend hours searching for the right sources all across the internet, the process becomes confusing, boring, and far more time consuming than necessary.

Since I first started The Axx (and created The Action Page as a place to make my actions available to anyone who wanted them), I have been asked again and again if I knew of a place to go to quickly and easily learn how to understand and build these actions. I have grown tired of having no good answer to this question. As a result, I have decided to take my best shot at creating a source for that answer. This article will attempt to centralize all of the necessary information for a complete beginner to quickly and easily go from little to no prior knowledge of the subject to being able to understand and build their own complex workflows with Drafts and URL actions. I will only be focusing on Drafts here, but the skills learned throughout this guide should be easily transferable to other apps, like Launch Center Pro and Editorial. For intermediate, and perhaps even expert action-builders, I will hopefully have some tips that will interest you as well in the last few sections of the article.

Before we begin, be sure to enable the “Allow URLs to trigger actions” setting (found almost all the way to the bottom of the settings pane in Drafts under “URL Security”), which is disabled by default. This setting will allow you to trigger actions externally via URL, a key component to chaining apps together with Drafts, or using apps like Launch Center Pro or Bookmarklets in Safari to run Drafts actions automatically.

So here it is, my Comprehensive Guide to URL Schemes and Drafts Actions. (more…)

Fantastical and LCP

I recently realized that I wanted a way to quickly save photos or screenshots as todos, and being Fantastical 2 my todo manager (with Reminders) and Launch Center Pro the fastest way to take pictures and upload them to Dropbox, I combined them in two workflows.

I made two simple actions that mix the Launch Center Pro and Fantastical URL schemes to save a Dropbox image link as a reminder in Fantastical. You retain the ability to type natural language in a Launch Center Pro prompt, and Fantastical will also automatically recognize the URL and put it in the URL field of a reminder.

Some details worth noting about the actions:

  • The first one lets you take a new photo; the second one grabs any image from the Camera Roll;
  • Both actions will upload an image to Dropbox in the Photos/LCP/ folder; you can change this once you install the action;
  • Fantastical is set to create a reminder for the received text through the reminder=1 flag in the URL scheme.

Getting all the encoding right was a bit tricky at first, but the actions should work without any further configuration on your end. Feel free to modify them: with my basic structure in mind, you can replace Fantastical 2 with Drafts, Dispatch, or any other app that can receive text via URL scheme. I just find it handy to be able to quickly save photos in Fantastical as tappable links, but the workflow is really up to your imagination.

You can download the actions here: