This Week's Sponsor:

Winterfest 2024

The Festival of Artisanal Software


Posts tagged with "iOS"

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.


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.


TAKE ACTION - Action Menu Generator For Launch Center Pro

Nice work (and great name) by Jeff Mueller: starting from my idea for an action menu for Safari in Launch Center Pro, he made a web app to simplify the process of assembling the bookmarklet. You can choose from a set of emojis for icons, select one of the built-in actions (so you don’t have to write URL schemes), and hit Create Menu to generate a menu. It’s very simple and much better than writing code manually.

I hope that Jeff will add more app actions and emojis soon. Check it out here.

Permalink

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


Launch Center Pro for iPad Review

Launch Center Pro

Launch Center Pro

Contrast’s Launch Center Pro, the app that started the small revolution of iOS automation in June 2012, arrives today on the iPad with a new version (sold separately at $4.99) that takes everything you know about Launch Center Pro for iPhone and scales it up to the bigger screen. Launch Center Pro for iPad doesn’t do anything dramatically different from its iPhone counterpart: you can create custom actions, play around with Dropbox and clipboard integration, and do all the things that were possible in Launch Center Pro 2.1 – only now on your iPad too.

Finally.

Read more


Workflow Requests #1

Earlier today, I asked:

I had some free time, and decided to provide a solution to some of the requests I received. I don’t know if I will repeat this experiment in the future (although it’s likely, because I had fun), but if you have questions, feel free to ask. I don’t see why you shouldn’t speed up that tedious task you’ve been doing over and over on your iPad or iPhone with an action, workflow, or script.

The best part – you can download the actions below and skip this step entirely.


Permalink

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


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: