This Week's Sponsor:

Kolide

Ensures that if a device isn’t secure it can’t access your apps.  It’s Device Trust for Okta.


Posts tagged with "drafts"

Automating iOS: A Comprehensive Guide to URL Schemes and Drafts Actions

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. Read more


Tweetbot Workflow: Upload and Share Dropbox Text Files

Tweetbot workflow

Tweetbot workflow

In Tweetbot 3, Tapbots removed the ability to post tweets longer than 140 characters using built-in services for text upload. While I understand that it wasn’t one of Tweetbot’s most used features, its removal got me thinking: would it be possible to replicate the feature using Dropbox and plain text files in an automated iOS workflow? I came up with a solution that requires Launch Center Pro and Drafts, and I’m quite happy with it.

Read more


Drafts 3.5 Brings Refined Interface for iOS 7, Action Improvements

Drafts for iOS has singlehandedly reinvented, alongside Editorial, my iOS workflow. With a combination of URL schemes and custom actions, direct Dropbox and Evernote integration for saving text, callbacks, and a fervent community of passionate users pushing the app to its limits, Drafts has become an extremely powerful iOS notepad without losing its basic simplicity. Drafts is the perfect example of an app that is easy to use and approachable but that power users can tweak and enhance if they know where to look.

With the release of iOS 7, developer Greg Pierce has decided to make Drafts 3.5 an iOS 7-only app that includes an updated design and some new features for power users. This will likely be a controversial decision among users who won’t update to iOS 7 right away, but I certainly understand the motivation of wanting to move forward as fast as possible by promptly embracing our iOS 7 future.

Drafts didn’t have much custom UI to begin with, so this new version’s most visible changes are the keyboard, which defaults to the iOS 7 one, and the revised icons and menus that match iOS 7’s new design trends and guidelines. Icons are thinner, the Settings’ cells run from edge to edge, the On/Off switches are new, the status bar blends with the writing area, and there’s a lot more whitespace. After having used Drafts 3.5 for a few months, I would say that, in the transition to iOS 7, it has lost less than Pierce’s other app, Terminology, in terms of identity and personality. Drafts was already spare and clean-looking – iOS 7 just makes it official and takes the app’s whitespace up a notch. Overall, it’s still the same Drafts, now with new icons and an updated keyboard.

The additions to Drafts 3.5 should please power users and those who rely on Drafts as an application launcher more than a note-taking app. Read more


Soulver for iPhone Updated with iCloud Syncing, URL Scheme

Soulver, my favorite iOS calculator app that isn’t really a calculator (I like another app for that), was updated today on the iPhone to support iCloud syncing, sub-folders, and a URL scheme. iCloud syncing was first brought to Soulver for Mac in December 2012, and now the iPhone app (Soulver for iPad hasn’t been updated yet) should be capable of syncing named documents with its Mac counterpart. If you trust iCloud with your Soulver documents, I guess that this will be a handy addition.

The URL scheme is much more interesting for my workflow. According to the release notes on iTunes, there’s now a URL scheme to launch Soulver, create a new document with text, or even to append text to an existing document. I am already thinking about the possibilities opened up by this feature for integration with apps like Launch Center Pro and Drafts – but I can’t find documentation anywhere. The app does support a soulver:// URL scheme, and hopefully more information will soon be posted on Acqualia’s website.

I’m looking forward to playing with Soulver’s URL scheme and updated preferences (not so much with iCloud sync). Soulver for iPhone is $2.99 on the App Store.

Update 9/1: The guys at Acqualia have posted a URL scheme documentation here. I have already set up a Drafts URL action that lets me quickly type a calculation in Drafts – which is my go-to text capturing tool – and append it as a new line to a specific Soulver document I have called “Calculations”. From Drafts:

soulver://new?text=[[draft]]&title=Calculations

I’m already using this action all the time to launch quick currency conversions in Soulver. Open Drafts, type “2 usd in eur”, and boom – Soulver opens, displaying the result. It’s a nice URL scheme.

Permalink

Resolve Short URLs with Pythonista on iOS

Clean URLs

Clean URLs

I don’t like it when third-party apps or services force me to share links to articles or webpages using their own custom shortened links. I understand the appeal of personalized short domains – after all, we tweet mcstr.net links with the @macstoriesnet account – as they can provide analytics to track clicks, can save characters, and, at least in theory, they “look cool”. However, I’ve been long considering the idea of dropping our mcstr.net links, but I think the issue is worse (and more annoying) for apps and services that don’t tweet links to their own content (like we do) but that override others’ links with different domains. An example is Pocket, which gives you the clean, original URL when you choose the “Copy Link” action from the sharing menu, but that instead returns pocket.co links when sending text to Drafts (which I do often). I’ve grown tired of this practice (in Pocket and other services), and I’ve put together a workflow based on a Python script that allows me to easily resolve short links without having to open the browser and tap on multiple menus. Read more



Getting Safari’s Selection on iPad As HTML With A JavaScript Bookmarklet

I modified this bookmarklet posted by “Tim Down” on StackOverflow to send selected text from Safari to Drafts as HTML. The result is the following code:

javascript:(function(){var%20h="",s,g,c,i;if(window.getSelection){s=window.getSelection();if(s.rangeCount){c=document.createElement("div");for(i=0;i<s.rangeCount;++i){c.appendChild(s.getRangeAt(i).cloneContents());}h=c.innerHTML}}else%20if((s=document.selection)&&s.type=="Text"){h=s.createRange().htmlText;}window.location='drafts://x-callback-url/create?text='+(h);})()

So let’s say you want to grab the first paragraph in this post. Normally, in Safari for iPad you’d end up with the plain text fetched by window.getSelection:

This is a fantastic report with lots of data points for any developer trying to get their apps featured by Apple. Dave Addey’s highly interactive regional graphs and notes are very well done. Be sure to check out Dave Addey’s other works on his main blog.

As you can see, formatting and hyperlinks have been removed. With the bookmarklet above, you’ll receive the HTML version of the selection – which looks like this. But what’s the point?

My idea was that I wanted to be able to automate the process of capturing rich text from iOS’ Safari; I wanted to achieve the same kind of functionality I have on the Mac, where rich text can be dragged from Safari or Chrome and dropped into Evernote, preserving styles, hyperlinks, and images. I thought that combining HTML output with an Evernote Append action (with the “Send as Markdown HTML” option turned on) would let me receive valid HTML content in Evernote starting from an iOS workflow. And, for the most part, I was right, because the workflow does mostly work.

As it turns out, Evernote is extremely cautious with the HTML tags they accept, and the ones that are supported follow the XHTML guidelines as ENML is a superset of XHTML. This means that my bookmarklet will work for something as simple as selecting a single paragraph, but may easily fail with multiple selections, inline images, complex styles, and so forth. When that will happen, Drafts will return an error when trying to append HTML to Evernote; obviously, this will work just fine with Dropbox, which doesn’t care about the kind of text you’re using in your actions. Even better, this should work very well with Textastic’s just-released update that supports x-callback-url.

I guess the solution would be to build a Pythonista-based converter for Evernote-approved XHTML tags and place it between Safari and Drafts, converting HTML tags Evernote won’t like to compatible ones. If you’re interested, my birthday is August 10.

Permalink


Share To Flipboard Magazines From Drafts

Flipboard

Flipboard

I’m a big fan of Flipboard’s magazine feature, which was introduced earlier this year with version 2.0 of the app. By leveraging Flipboard’s existing presentation style – capable of re-formatting web articles, videos, and photos with a beautiful print-like layout – magazines allow anyone to put together a collection of interesting links that others can subscribe to, read, and share. I am subscribed to dozens of Flipboard magazines and I send links to my Games one on a daily basis.

Most of my automation tips stem from minor annoyances with default solutions, so yesterday I decided to create a simple, yet effective Drafts URL action to easily open Flipboard’s share interface without having to read a webpage in the browser. Read more