This Week's Sponsor:

PowerPhotos

The Ultimate Toolbox for Photos on the Mac


Posts in tutorials

iOS 7 and Mail Message URLs

A feature of iOS 7 that I quickly described in my article and that I haven’t seen mentioned in other places is the possibility to make Apple’s Mail app open individual messages through a new message:// URL scheme. As I wrote:

In iOS 7, if you have a message URL that corresponds to a message, the URL will correctly open it directly in Mail. There are two limitations: the message has to be already downloaded in the Mail app, and, of course, you have to know the URL. So far, I haven’t found a way to create URLs to reference Mail messages on iOS, but the ones you create on your Mac through AppleScript and Mail.app will continue to work on iOS 7 devices. Therefore, if you have scripts that generate these URLs to, say, attach them to OmniFocus or Evernote, you’ll be able to tap them and open the associated message on an iPhone or iPad. I look forward to seeing whether developers will figure out a way to generate message:// URLs on iOS.

That wasn’t the first time I covered message:// URLs on MacStories. In November 2012, I posted an AppleScript to quickly save a message’s URL in Evernote for Mac with a hotkey; and even then, I was referencing a 2007 post by John Gruber on the topic:

The structure of these URLs is fairly simple: (1) the “message:” scheme, followed by (2) the message-id of the message, enclosed in angle brackets (“<” and “>”). The message-id is specified in each message’s “Message-ID” header field, which is part of the Internet email standard. Every message-id should be universally unique, and every message should have a message-id. In my testing, the only messages I could find that didn’t have Message-ID headers were spam; such messages cannot be referred to by Mail’s “message:” URLs.

The message:// URLs that Apple introduced in Leopard have gone mostly unchanged in terms of OS X integration throughout the years, proving to be a nice solution to reference specific messages in todo apps, note-taking apps, and so forth. Rather than searching for a message in Mail, you can generate a URL via AppleScript, archive it somewhere, and launch it (either by pasting it in Safari or right-clicking it in a Cocoa app) to open the referenced message in a separate Mail window – no matter if the message has been archived, put in a folder, or left in the inbox. Read more


For The Colorful: Create iOS 7 Wallpapers From an iPhone or iPad

With the release of iOS 7, I wanted to find some cool custom wallpapers that would fit with the OS better than some of the default options provided by Apple. I want my iPhone and iPad to look nice – with iOS 7, the wallpaper is now an essential part of the experience, providing the color background for several system apps and features. I don’t have the time to browse around dozens of wallpaper websites, and I don’t have the knowledge to fire up Photoshop and create my own wallpaper that has just the right amount of color I want. Fortunately, the developer community has thought about people like me who want nice iOS 7 wallpapers with minimal effort, offering apps that make it easy to mix colors and gradients to give your iOS 7 device a unique look. Read more


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


Transfer Files with Alfred - Zero Config Required

File transfers between computers on a network can be a pain. No one wants to memorize hostnames and IP addresses are often dynamic. Apple made huge strides in simplifying the process with AirDrop but the UI leaves a lot to be desired especially if you are looking for fast transfers with minimal interactions. If you are an Alfred Powerpack user then you are probably already familiar with the many ways Alfred workflows can speed up simple actions without ever having to take your hands off the keyboard. Wouldn’t it be great if you could transfer files using Alfred with absolutely no configuration?

This is exactly what I had in mind when I made the Alfred File Transfer workflow. So how does it work? It is powered by the pyncp project. A few months ago one of my favorite blogs, One Thing Well, linked to the pyncp project which is a Python port of the popular linux utility – NCP. Pyncp is essentially a command-line tool for copying files across a LAN without any configuration. You simply run the pyncp push command on one computer, then run the pyncp poll command on the second computer and file is transferred. However, I ran in to some initial issues that prevented pyncp from working properly on OS X – so I forked the project, refactored some code, and got it working.

The Alfred File Transfer workflow is simple. First, install the workflow on each computer. Then select a file to transfer in Finder and show the list of available Actions using Alfred’s ⌥ + ⌘ + \ keyboard shortcut. Type push and select the corresponding Alfred action. On the second computer, simply bring up Alfred and type pull – the file will be transferred to the ~/Downloads folder on the destination computer. That is all there is to it!

Check out a video of the workflow in action:

This workflow is simple yet very powerful because it allows you to move files across your network using nothing more than your keyboard. It is worth noting that this does not provide the encryption and security provided by AirDrop so if you are transferring sensitive information on a public network – use with caution. However, I have found it extremely useful on my personal computers at home. If you find this workflow handy be sure to thank Felix Richter for his hard work porting NCP to the Python language.

Download the Alfred File Transfer workflow.



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


Enhancing Reminders with AppleScript and Macros

As The Omni Group keeps working on OmniFocus 2 for Mac and Apple continues seeding new betas of iOS 7 and OS X Mavericks to developers, I have been reconsidering Reminders’ simplicity and enjoying the built-in iCloud sync, which, unlike other types of iCloud, is working fine for me. However, two things I miss from OmniFocus are the possibility to integrate the app with a web browser through bookmarklets and the system-wide Quick Entry panel; I use both tools on a daily basis to easily save a browser’s tab into OmniFocus’ Inbox, or to bring up a text field where I can jot down an idea and know that, no matter the app I’m using, it’ll be saved into OmniFocus. Luckily for me, Apple’s Reminders app comes with a good AppleScript Dictionary, which is likely something that Reminders’ core mainstream audience won’t ever care about, but that we can leverage to extend the app’s capabilities and input areas beyond Mountain Lion’s leather-and-paper window.

Read more


Automating Mail Signatures and Senders with AppleScript and Keyboard Maestro

Mail Keyboard Maestro

Mail Keyboard Maestro

I’m aware of the fact that it’s a common trend to call email a “nightmare” these days, but the truth is – email works for me. I have multiple addresses set up, I have my filters and smart folders to automate the process of filing and finding emails, and I’m enjoying the renewed interest of iOS developers in building email apps that solve old problems in new ways. But there is one thing I don’t like: Apple’s Mail app and how many clicks it takes to switch between configured accounts and signatures. As you can guess, I came up with a way to automate the process using AppleScript and (optionally) Keyboard Maestro.

I receive several messages every day to different email addresses, but I always want to reply with the same address and the same signature. Apple’s Mail app makes it easy to see all messages sent to all accounts with the unified Inbox, but it makes it surprisingly hard to set default accounts and signatures that should always be treated as, well, default ones. I don’t want to click on menus for accounts and signatures: I want to hit ⌘R and receive a new Reply window with the account and signature I want already set. Read more