This Week's Sponsor:

PowerPhotos

The Ultimate Toolbox for Photos on the Mac


Posts in tutorials

Creating and Sharing Text Files In Launch Center Pro

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.


Setting Up a Family Friendly Environment on iOS with Restrictions, Guided Access, and OpenDNS

When I handed down my iPad to a loved one, they were given a device that would give them unlimited access to the Internet. For the first time, they could access the news and weather, research articles, and Google just about anything without having to rely on me or someone else to help them. iOS devices like the iPad are lauded because they make doing things like this ridiculously easy for someone who isn’t computer savvy, and I’m comforted in knowing that the iPad isn’t likely going to suddenly stop working or become infected by a virus. At the same time, I want to make sure their experience is pleasant, and that they don’t accidentally enter a password in a phishing site or stumble upon something that might be offensive to them. We either have parents or grandparents who’re just learning about what devices like the iPad can offer them, and it’s our job to make sure they stay safe.

Parents don’t want their young child stumbling upon anything they shouldn’t, and we certainly don’t want curious kids making accidental in-app purchases, rummaging through our email, or deleting personal apps. Parents want to create safe and fun environments for their children, especially if the intention is to use an iOS device as an educational tool.

In a family setting, it’s about striking a balance. How do you make it comfortable for the grownups in the house who want to use their devices as is, while keeping your child safe online?

Read more


Matching URLs In Editorial with John Gruber’s Regex Pattern

Editorial for iPad

Editorial for iPad

When I’m writing in Editorial, I often need to make sure I’m dealing with a valid URL in the system clipboard, the document editor, or in a variable. To do so, I’ve long employed John Gruber’s liberal, accurate regex pattern for matching URLs, which has reliably allowed me to confirm that a workflow is about to handle a proper URL rather than a string of text that contains something else. Gruber recently improved the regex pattern again, and that seemed like a good opportunity to briefly detail how I’ve integrated his pattern in my workflows.

The key to match URLs and provide error-handling features in Editorial is to use a conditional block based on a regular expression pattern. Editorial comes with this functionality built-in: given a regex pattern, a block of actions can be run only if a value (plain text or variable) matches the pattern. In this way, you can run a set of actions if you have a URL, and another set if you don’t have a valid URL.

I’ve created a simple workflow that can be installed and reused as a preset in other workflows. The workflow, called Match and Open URL, consists of a single If block that checks for a URL contained in the clipboard. If you have a URL that matches Gruber’s pattern, the URL will be extracted from the clipboard and launched in the browser; if you don’t have a URL…it’s up to you to provide an alternative.

Editorial makes it extremely easy to build this kind of advanced workflow with just a few built-in actions. Gruber’s single-line version of the regex pattern can be pasted in Editorial’s If action with no modifications; inside the If block, the text in the clipboard is passed to a Find action that extracts a URL using the same, untouched single-line regex pattern. The extracted URL is opened in the browser and a HUD alert is displayed.

Combining Gruber’s regex pattern and Editorial’s workflow system can yield interesting results. You could use a variable instead of the system clipboard to match URLs; you could implement the pattern in a Repeat block that performs a set of actions for every matched URL found in the target text; instead of having my workflow inside an If block, you could match a URL among other bits of text, extract it, and do something with it. Editorial is a text automation playground and your imagination’s the limit.

You can download the workflow on Editorial Workflows’ website, and check out John Gruber’s regex pattern here.

Note: The screenshot above shows a beta version of Editorial, currently in testing.


Safari Action Menu In Launch Center Pro

Launch Center Pro action menu

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


A Simple “Open In Chrome” Keyboard Maestro Macro for Safari

My problem: I haven’t installed Flash on my Mac and I sometimes need to watch YouTube videos that require Flash Player in Google Chrome. Google’s browser is my Flash shelter: Safari is my main browser and I only keep Chrome around for Flash videos. I was getting annoyed by the process of copying a URL -> launching Chrome -> pasting the URL, so I made a simple Keyboard Maestro macro to automate everything with a hotkey. I don’t know what took me so long.

The macro checks if Safari is the front window, and, if not, it displays a notification with an error message. I do this to prevent accidental hotkey presses for URLs that I don’t want to open in Google Chrome. If Safari is the front window, however, what required a bunch of steps in AppleScript to open the current Safari URL in Chrome is a single action in Keyboard Maestro: Set Google Chrome URL, using %SafariURL% as a variable.

The two additional steps –  Open Chrome and Wait For Chrome To Finish Loading – were necessary because I discovered that, when launched with a Set URL action, Chrome wouldn’t intercept the URL sent by Keyboard Maestro and would simply display a blank tab. In this way, Chrome is launched, paused for a second as it reloads open tabs or the start tab, and then the Safari URL is opened in the current tab. If you want to open the URL in a new tab, change the Set Chrome URL action to New Google Chrome Tab.

You can download the macro here.


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


PaintCode: Vector Drawing to Code

header-image

header-image

If you are active in the Apple developer community, you are probably already familiar with PaintCode. It is a unique Mac app capable of turning your vector graphic design into pure Objective-C code. PaintCode is a professional quality app and the price tag is a reflection of that fact. The normal selling price of $99.99 (currently $19.99 via MacHeist) is a big pill to swallow for the average user but for a professional iOS/OS X developer it is merely a business investment. However, it is up to you to get your money’s worth out of the app.

PaintCode is full of tools that blend together the look and feel of traditional vector drawing apps while including customizable fields you would more commonly see in Apple’s Interface Builder. It supports numerous object shapes and custom bezier paths, as well as detailed color options including linear and radial gradients. The app is versatile and the uses are limited only by your imagination.

I thought the best way to give you an overview of PaintCode would be to come up with a sample project that I could walk you through. So I decided to make a menubar icon for a non-existent app. This app lets you drag files to the menubar icon to delete them, thus the icon needs to be a little trash can. Read more


My iOS Screenshot Generation Workflow

Screenshots

Screenshots

I didn’t think that complaining about iOS status bars on The Prompt would result in Dr. Drang going on a vision quest to produce better screenshots with Python. But I’m glad that I took the time to point out my dislike for messy status bars, because it led the good Doctor to work on some great scripts to automate the entire process with Python, which are compatible with Pythonista for iOS.

I waited to share my workflow for automated screenshot cleaning/generation because I wanted to see where Dr. Drang would end up with his script, Cleanbar. Now that he appears to have settled on a solution that requires standalone image files to act as partial status bar replacements, I think it’s the right time for me to share how I produce iPhone and iPad screenshots for MacStories.

The first step is to set up Cleanbar. I don’t need to repeat what Dr. Drang already explained, but to sum up: grab a black status bar, crop it to get two files similar to Drang’s, then run a script to pack those images as strings. Once set up, you’ll be able to a) use Cleanbar to clean single images picked from the Camera Roll with Pythonista and b) integrate it as cleanbar in other scripts to clean status bars programmatically.

As for my needs:

  • I usually need to combine two iPhone screenshots side-by-side in a single image as you can see in most reviews on this site;
  • I may or may not need to clean their status bars;
  • I don’t have to combine iPad screenshots. I only need to resize them and I may or may not have to clean their status bars;
  • Occasionally, I want to produce a banner with three screenshots (like this one), which can have original or cleaned status bars;
  • Sometimes, I only need to clean one screenshot out of two;
  • I always need to upload the final image to a Dropbox folder, which is monitored by Hazel.

And, because I’m not an animal, I wanted to automate all of this. The scripts that you’ll find below are the result of late night tweaking and lots of tests; they probably aren’t the most elegant or “Pythonic” way to handle this kind of image generation, but they work for me and they make me save several minutes every day. I haven’t been generating review screenshots manually in months, and they’re more flexible than my old workflow based on Keyboard Maestro.

Read more


Save Photos As Reminders with Fantastical and Launch Center Pro

Fantastical and LCP

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: