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 "URL Scheme"

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



Use WhatsApp’s URL Scheme with Drafts, Launch Center Pro, Or A Bookmarklet

WhatsApp

WhatsApp

I don’t use WhatsApp much[1], but when I saw the app’s documentation last night with a mention of the URL scheme, I thought I could play around with it a little bit.

The WhatsApp URL scheme is extremely basic and there’s one part that I can’t get to work. The scheme itself is, unsurprisingly, whatsapp:// – which you can use from Launch Center Pro if you simply want to launch WhatsApp. There are also parameters to do stuff with the URL scheme: text lets you pass along a (properly encoded) text message that will be automatically inserted in the compose field of the app; abid lets you specificy an “Address Book ID” to send a message to a specific contact.

The WhatsApp team explains:

Address book ID of contact to start a chat with. If contact with this ID has only one whatsapp-able phone number, application will open a conversation with that contact. If contact with this ID has more than one whatsapp-able phone numbers, application will present a menu with all phone numbers available for chat. If contact has no whatsapp-able phone numbers, or contact with this ID does not exist, or this parameter is missing, application will present contact picker listing all contacts available for chat via WhatsApp.

I thought that something like the following URL would have let me send the text message “Test” to my contact “Alex”:

whatsapp://send?abid=Alex&text=Test

But, in practice, I wasn’t able to get the abid parameter to work. I have tried with phone numbers, percent-encoded names and phone numbers, email addresses, but I can’t get WhatsApp to recognize the abid parameter I pass along, as the app continues to present a contact picker. Therefore, for the purpose of this post, I will show you how to send text to WhatsApp, choosing a recipient from the app’s built-in contact picker. If you manage to get abid to work, please let me know. 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


Pushpin 2.0: A Powerful Pinboard Client for iPhone

Pushpin 2.0

Pushpin 2.0

On the first episode of The Prompt podcast, I chose Pushpin 2.0 as my weekly pick, and I thought the app deserved a mention here on the site as well.

In January, when I first reviewed Pushpin, I noted how the app didn’t look as good as Pinbook, another Pinboard client that, back then, didn’t support some of the power-user functionalities that were available in Pushpin. Many Pinboard clients have come out in the past few months; as MacStories readers know, my choices have always been Pinbook, Pushpin, and Pinbrowser – while these three apps were all made for Pinboard, each one of them had a peculiar feature that made it stand out. With Pushpin 2.0, I feel like the difference is now marginal, as the app takes important steps towards becoming the only Pinboard client you’d ever need to add, manage, and browse Pinboard bookmarks. Read more


Using Tweetbot Searches to Replace RSS

Sean Korzdorfer shares a Tweetbot tip that I didn’t know about: you can construct complex searches with boolean operators and filters and launch them with a URL scheme, both on OS X and iOS. And not just regular searches – you can apply a query to look for specific keywords inside a Tweetbot search.

Basically, Sean is using Tweetbot searches to replace RSS feeds. By saving searches that filter out RTs, mentions, and tweets in foreign languages, he receives a stream of tweets containing links from a specific set of users. Sean has turned his searches into Alfred workflows for Tweetbot on the Mac, and I thought I could do the same on iOS.

Sure enough, here’s a Launch Center Pro action to launch a Tweetbot search for links (no RTs, no mentions) from users I care about:

tweetbot:///search?query=from%3Amacrumors%20OR%20from%3Averge%20OR%20from%3Adaringfireball%20OR%20from%3Apolygonall%20OR%20from%3Akotaku%20OR%20from%3Amacdrifter_feed%20OR%20from%3Areneritchie%20OR%20from%3Amattalexand%20OR%20from%3Anateboateng%20OR%20from%3Adujkan%20OR%20from%3Amarkgurman%20OR%20from%3Apanzer%20filter%3Alinks%20-filter%3Amentions%20-filter%3Aretweets%20lang%3Aen%20[prompt]

And here it is decoded for reading purposes:

tweetbot:///search?query=from:macrumors OR from:verge OR from:daringfireball OR from:polygonall OR from:kotaku OR from:macdrifter_feed OR from:reneritchie OR from:mattalexand OR from:nateboateng OR from:dujkan OR from:markgurman OR from:panzer filter:links -filter:mentions -filter:retweets lang:en [prompt]

The URL action ends with a [prompt] for Launch Center Pro, but that can also be a [[draft]] for Drafts. You’re not forced to launch the search URL with a keyword – if you don’t enter anything in the prompt, Tweetbot will display all links from the search (which is why you probably don’t want to use Drafts for this, as it can’t launch an action from an empty draft). Also, you can see that the first portion of the URL isn’t percent-encoded, but the one after the query parameter is. For this, Launch Center Pro’s encode/decode actions can come in handy.

I am subscribed to a series of Twitter lists to discover interesting links on a daily basis, but these complex searches have the advantage of filtering out RTs and mentions, providing a cleaner, links-only experience.

Permalink

Rdio 2.2 Includes URL Scheme for Search

Rdio 2.2, released earlier today, includes – besides an improved interface and label search – a new URL scheme for launching searches from other apps (thanks, Adam). The URL scheme is fairly simple:

rdio://search/[search term]

In the past, I relied on a hack made possible by Bang On to redirect Rdio web URLs to the Rdio app. The problem with that solution was that it was a finicky process that couldn’t launch full, native searches directly in the Rdio app. The new version enables just that: you can now use the URL scheme to create search actions that will display pre-populated results in Rdio for iOS.

The new URL scheme means it’s easy to set up actions that trigger Rdio searches in apps like Launch Center Pro or Drafts. For this kind of quick search, my pick is Launch Center Pro, which I already use to launch Chrome and Pinbrowser searches. Until the Launch Center Pro team adds support for Rdio search in the Action Composer (they’re aware of it), you can create a custom action with the following URL:

rdio://search/[prompt]

Then, every time you want to search for something on Rdio, instead of opening the Rdio app and manually heading to the search field you can just open Launch Center Pro, type your search terms in a keyboard prompt, and tap a button to be redirected to a search inside the Rdio app.

I’ve been looking forward to a Rdio URL scheme for search for a long time. If you don’t want to use Launch Center Pro, you can build a custom action for Drafts, Mr. Reader, or any app that supports launching other apps via URL scheme.


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