This Week's Sponsor:

1Blocker

A Cleaner, Faster, and More Private Web Experience


Posts tagged with "URL Scheme"

iOS Automation and Workflows with Drafts

The latest update to Drafts – a “quick note capturing” app that I’ve covered several times on MacStories – adds a series of features aimed at increasing the possibilities of workflows automation on iOS devices. Obviously, this is something I’m interested in.

It seems like enabling users to save time while using apps has been a common thread in the past few months. The success of Launch Center Pro probably “raised awareness” in regards to the whole concept of URL schemes, but it’s been the increased adoption of x-callback-url and interest in automated workflows that proves better inter-app communication is something that (at least) third-party developers are thinking about. Google included a powerful URL scheme in Google Maps and Google Chrome; more recently, Mr. Reader showed how to enable a “services menu” by requiring users to mix URL schemes from other apps with parameters for an article’s title or selected text. These aren’t ideal solutions, but it’s all we have for now.

Greg Pierce, creator of the x-callback-url specification, has improved Drafts in ways that not only make the app more useful to get text onto other services, but also broaden the possibilities for automation through the use of URL schemes.

There are three main new features in the new Drafts: Dropbox actions, URL actions, and an improved URL scheme with support for callbacks and action triggers. I am going to explain how they work and include various actions and bookmarklets to demonstrate different use cases. Read more


Due Clipper For Google Chrome

When there are no actual news or notable app releases, I prefer investing my time in creating something for other people.

Continuing my ongoing series of tips on iOS URL schemes, here’s an adaptation of my existing Due bookmarklet to work better with Google Chrome for iOS (which, as I’ve pointed out several times, has a very nice URL scheme). The following code (to install it, simply copy it and paste the entire string into a bookmark) grabs a webpage’s title and URL and sends them to Due (also powered by a great URL scheme). Read more


Create New Byword Notes From Mr. Reader

Create New Byword Notes From Mr. Reader

I’m a big fan of Mr. Reader’s new services menu. Through URL schemes (documented here), it allows the app – a Google Reader client – to send selected text, URLs, or article titles to other apps. One of the custom actions posted by the developer allows you to create a new note in Byword, possibly formatted as a linked post for your blog.

The action (which you can download here) uses by Byword URL scheme to create a new note. In the note, you can have the article’s original title, some selected text, and a source link formatted as Markdown. As shown in the image above, you can modify the template with any characters you want. For instance, I added a > character before [TEXT-SELECTED] to format the selection as a quote block in Markdown.

I personally use Nebulous Notes and Poster to create articles for MacStories on the iPad, but a lot of folks like Byword. Check out the Mr. Reader action if you’ve been looking for a way to send text and links from Google Reader to Byword.

(Bonus: here’s a quick video showing the action)

Permalink

Chrome for iOS: Send A Webpage Back To Safari Via Bookmarklet

Sort of. Here’s a fun experiment.

Today, I wanted to quickly send a URL from Chrome for iOS – my default browser – back to Safari. I know there are ways to do Safari-to-Chrome, but I wanted the opposite: from Chrome back to Safari. I needed to install some custom Mr. Reader actions, and Chrome was giving an error when tapping on the downloadable files. I figured I could make a bookmarklet to take the current webpage in Chrome and send it to Safari.

Not so fast. There’s no documented URL scheme on iOS for opening web links in Safari, except, well, the http:// scheme itself. In testing various bookmarklet ideas, I thought that replacing googlechrome with http in Jon Abrams’ bookmarklet would force Chrome to send a link to Safari. But as It Turns Out™, doing this sort of trick in Chrome for iOS:

javascript:window.open('http'+location.href.substring(4));

…simply opens a new tab in Chrome.

What I ended up using is a hack – and a very curious one – to leverage Chrome’s support for x-callback-url to open a link back into Safari. I was inspired by Cormac Relf’s script, which I discovered yesterday when he showed me another script he made for Pythonista.

javascript:window.location='googlechrome-x-callback://x-callback-url/open/?url='+encodeURIComponent(location.href)+'&x-source=Safari&x-success='+encodeURIComponent(location.href);

As you can see above, we’re telling Chrome to open a new tab using…itself. The trick, at least theoretically, is to use an encoded location.href string to call back Safari, which is registered for the http:// scheme that Chrome, in this case, opens “externally”. Displaying x-source is needed per Google’s URL scheme specification; the name you give to x-source will be displayed as a “back” button in Chrome (as shown in the image above).

This is a profoundly inelegant and ultimately flawed solution. To make this “work” you have to:

  • Type the bookmarklet’s name, because Chrome has no bookmarks bar;
  • Nothing will happen.
  • Close Chrome;
  • Re-open it;
  • A wild new tab appears!
  • Tap the Safari button. It’s super-effective.
  • Safari will launch the link, closing the additional tab Chrome decided to open.

What is going on, exactly? Via JavaScript, we’ve forced Chrome to open a tab in itself, but doing so with x-callback-url inside a bookmarklet creates, for some reason, quite a strange behavior: the tab isn’t opened unless you close and re-open Chrome, therefore partially defeating the whole purpose of this bookmarklet, which is to quickly open a webpage in Safari. But, in spite of the clunky process, a new tab with a “Safari button” is created nevertheless, allowing you to tap it to launch Safari and close Chrome’s extra tab.

My conclusion is that we have three solutions: a) it’s not possible to create a straightforward Chrome-to-Safari bookmarklet; b) it’s possible in another way that I haven’t explored; or c) it’s possible with the x-callback-url hack, but in a different way.

If you have ideas, ping me on Twitter.


Mr. Reader And The Services Menu for iOS

A “services menu for iOS” is a chimera advanced users and developers have long been trying to hunt down. It all started with a mockup Chris Clark posted in 2010, showing how third-party iPhone apps could offer their “services” – just like OS X apps – to the user through a contextual menu. The concept became popular fairly quickly, but, eventually, Apple did nothing.

Fast forward to 2013, iOS users are still asking for better integration of third-party apps with each other. Developers have resorted to using URL schemes, a rather simple way to directly launch other apps and pass information to them – usually bits of text. App Cubby’s Launch Center Pro has become the de-facto solution to create a “Home screen of app shortcuts”, offering a series of tools (such as automatic encoding and different keyboards) to make the process of customizing URL schemes as user-friendly as possible. Launch Center Pro is, in fact, the utility behind many of my favorite iOS tricks.

Pythonista has also become a big part of my iOS automation workflow. Combining the power of Python with the possibility of launching URL schemes, I have created a series of scripts that help me get work done on iOS on a daily basis. Further leveraging Greg Pierce’s x-callback-url, I have ensured these scripts can take a set of data, send it to other apps, process it, then go back to the original app. You can read more about Pythonista in my original article, and I’ve been following updates from developers who implemented URL schemes as well with a dedicated tag on the site.

I concluded my Pythonista article saying:

I believe that, going forward, Pythonista and other similar apps will show a new kind of “scripting” and task automation built around the core strenghts of iOS. As we’ve seen, x-callback-url is a standard that leverages a part of iOS – URL schemes – to achieve simple, user-friendly and URL-based inter-app communication that can be used in a variety of ways. Looking ahead, there’s a chance rumored features such as XPC will bring more Mac-like functionalities to iOS, but developers will still find new ways to make iOS more powerful without giving up on positive aspects such as increased security and the simplicity of the app model.

Mr. Reader – a Google Reader client that I’ve covered on MacStories in the past, and my favorite RSS app – has today been updated to version 1.11, which introduces a generic solution for launching URL schemes that shows how iOS automation is a growing trend, albeit substantially different from what we’re used to see on OS X. Read more


Poster 2.0

Tom Witkin’s Poster is my favorite WordPress blog editor for iOS. Poster comes with a clean interface, support for Markdown (the app can convert plain text Markdown to HTML before publishing), and full WordPress integration. The app’s excellent support for WordPress features like custom fields, drafts, slugs, and images means I don’t have to write on the iPad and later “adjust everything” on a Mac before publishing. Poster is, in fact, a core aspect of my iOS automation workflow.

Poster 2.0 is out today, and it’s another fantastic update that reassures me Tom is committed to making this app the best WordPress editor for iOS. The interface has been further refined, and it’s now easier on the eye with an even deeper focus on content rather than UI chrome. I don’t use these for MacStories, but Poster now supports WordPress custom post types and excerpts, alongside the “sticky” functionality that we use every once in a while to pin a post to the top of the site.

What I like about Poster 2.0 are the “minor” additions that make for a much better workflow. Custom fields can now be given a local label so that a friendlier name will be displayed in Poster instead of the actual name (e.g. “URLCustom_linked” becomes “Linked post”); the Markdown preview and HTML conversion now handles en and em dashes (something that annoyed me in the previous version of the app); if you edit a published post (as we usually do when we catch typos or make corrections), you can now save the edited draft locally before publishing. I also appreciate how the “Copy to Clipboard” action now only received a post’s URL (Poster 2.0 builds on the solid foundation of Poster 1.0 for post sharing), and the app is noticeably faster at syncing multiple posts at once.

There are two more changes I want to mention. You can now insert images at any point in the editor by tapping & holding and selecting the “Insert Image” option from the popup menu; I tend to do all my image insertion beforehand, but this is a welcome addition for those times when I may forget about an image. And last, Poster now supports Greg Pierce’s x-callback-url to return to a specific URL after completion. Poster already had support for a URL scheme that allowed post creation from other apps, but now you’ll also be able to create a post and return to another app.

Here’s a bookmarklet I made to grab a browser’s selection and use it as text in Poster, get a webpage’s title and use it as post title, open Poster, and return to the browser. This kind of URL callback enables a streamlined workflow for, say, discovering links in Safari, quickly posting them to WordPress, and going back to Safari again.

javascript:window.location='posterapp:///create?text='+encodeURIComponent(window.getSelection())+'&title='+encodeURIComponent(document.title)+'&callback_url='+encodeURIComponent(location.href);

I also made a quick video showing the process in action. Unfortunately, getting the browser’s selection only works on the iPad.

Poster is a great app, and while not revolutionary, the 2.0 update refines several aspects of the previous version and adds more powerful functionality for WordPress users and iOS automation geeks. I highly recommend it.


1Password 4.1

1Password 4.1

A new version of 1Password for iOS has been released on the App Store, and it contains several fixes and improvements, including some that I suggested in my initial review of the app. Aside from sync improvements and Display settings (I can now set Inconsolata as my password font), I particularly appreciate the possibility to double-tap on a tab on the iPad to go back to root view, and search in portrait mode on iPad. It is no longer needed to tap & hold on rows on item view to show the popup menu, and tapping a secure note shouldn’t bring up the keyboard anymore (as I mentioned in my review, I found that behavior confusing). If you have attachments in secure notes, they’ll now be shown as well in version 4.1.

My favorite feature of 1Password 4.1 is the new URL scheme. There are two types of 1Password URLs: one for search, and another to quickly open a website into 1Password’s built-in browser. The search URL is: onepassword://search/ followed by your search string. You can easily configure this with Launch Center Pro’s keyboard prompt to automatically bring up a search for an item in 1Password starting from Launch Center Pro. If you launch 1Password via URL scheme while it’s locked, 1Password will obviously ask you for the master password first, then proceed to visualize results that match your search.

The URL scheme for opening websites is far more useful for me. You can prepend “op” to a normal Safari URL (so it’ll look something like “ophttp://”) to open it directly into 1Password. For instance, typing ophttp://google.com in Safari will launch Google in 1Password’s browser. Therefore, I made a bookmarklet that you can click in Safari to open the current website in 1Password even faster; simply create a bookmarklet with this code:

javascript:window.location='op'+(window.location.href);

…And 1Password will launch the website you’re currently viewing. I tested the bookmarklet in Safari and Chrome for iOS; it has become a huge timesaver to quickly log into websites that I access on a frequent basis.

There are many other improvements in 1Password 4.1 that make the app faster, more stable, and that fix some of the graphical glitches that I mentioned in my review. There are some subtle additions as well, such as different colors for digits and symbols in the password field when a cell is selected. 1Password is one of my must-have iOS apps, and make sure to check out the new 4.1 version on the App Store.

Permalink

Pushpin for Pinboard

MacStories readers know that I’m a fan of Pinbook, a Pinboard client for iPhone and iPad. For the past two days, I’ve also been trying Pushpin, developed by Aurora Software, and I’m quite impressed with the feature set the app has reached at version 1.3. Pinbook and Pushpin are, ultimately, very different, and I believe their current versions can coexist on a Pinboard nerd’s iOS Home screen. Read more


Quick Unit Conversions With Measures and Launch Center Pro

Quick Unit Conversions With Measures and Launch Center Pro

Measures by Michael Neuwert is one of the iPhone apps I’ve been following here on MacStories since I started the site in 2009. I’ve later reviewed (and became a fan) of the iPad version of the app, Measures HD. The latest update to Measures for iPhone, version 2.3, adds more units, iPhone 5 support, and a URL scheme. As you know, automation and URL schemes for iOS apps is something I’ve been focusing on lately, so I was curious to try out the Measures implementation.

A basic Measures URL looks like this: x-measures://convert?from=USD&to=EUR&value=100 – but it’s also possible to simply launch a specific category without starting a conversion by using something like: x-measures://convert?category=Mass. The convert action may also contain a category parameter to avoid ambiguities, and it’s possible to search as well using: x-measures://search?q=Watt.

Being based in Italy but working (remotely) in a US environment, I do a lot of conversions on a daily basis. Primarily currency (EUR to USD and vice versa) and temperature conversions to understand what my colleagues are talking about when they say “it’s cold over here”.

It was very easy to set up a Launch Center Pro action (Measures isn’t listed in the officially supported apps in App Cubby’s launcher yet) to start a Dollar to Euro conversion in Measures using input from Launch Center Pro. Using the first example URL I showed above, replace the numeric value parameter with [prompt-num] in Launch Center Pro. This will ensure that a URL-encoded numeric string will be sent from Launch Center Pro’s number pad to Measures, directly displaying the conversion. In this way, I can keep Measures inside a folder, and create shortcuts for my most-used unit conversions that I’ll launch with a single tap from Launch Center Pro. Thanks to URL schemes, the conversion process will take two seconds and I’ll be shown the final result without having to tap or select anything else.

Currently, there’s no official documentation for Measures’ URL scheme and I’m not sure Michael is using the x-callback-url protocol (though it certainly looks like it). If you’re looking for a quick unit converter you can launch from Launch Center Pro (I was looking for a way to send a browser selection as well, but alas), check out Measures 2.3.

Permalink