This Week's Sponsor:


Where Text Starts

Posts tagged with "python"

Automating iOS: How Pythonista Changed My Workflow

A couple of months ago, I decided to start learning Python.

I say “start” because, as a hobby to fit in between my personal schedule and work for the site, learning the language is still very much a work in progress. I hope I’ll get to an acceptable level of knowledge someday. Coming from AppleScript, another language I started researching and playing with earlier this year, the great thing about Python is that it’s surprisingly easy to pick up and understand. As someone whose job primarily consists of writing, I set out to find how Python could improve my workflow based on text and Markdown; I found out – and I’m still finding out – that Python allows for more flexible and intelligent string manipulation[1] and that some very smart folks have created excellent formatting tools for Markdown writers.

But this article isn’t strictly about Python. Soon after I took my decision to (slowly) learn my way around it, I asked my friend Gabe Weatherhead about possible options to write and execute Python scripts on iOS. Thanks to Gabe’s recommendation I installed Pythonista, and this app has completely changed my iOS workflow. Read more

Convert URLs to Tweetbot Links

I communicate with my team through iMessage. We’ve tried many “communication services” over the years, yet, since last Fall, we’ve always come back to Apple’s solution. It’s not perfect for us, its reliability is far from 100%, but it works.

As we keep using iMessage every day, there’s one category of “media” we’re constantly sharing: Twitter URLs. We find some cool piece of information or news on Twitter, we share it with the team. Linking back to tweets has, in a way, become our favorite type of commentary for fun, news-hunting, and everything in between. URLs, though, aren’t the best way to jump back to a tweet, especially when you’re on a mobile device. When you’re on a Mac, clicking on a Twitter link will open a new browser tab, which doesn’t really bother us as we’re used to opening background tabs on our computers. But on the iPhone and iPad, it can become annoying: there’s a limit of 8 Safari tabs on the iPhone, you get yanked out of Messages, and, most of the time, URLs just don’t work. In our team chat, we’ve speculated the “Not Found” errors we’ve seen may be related to how Tweetbot generates Twitter URLs when you hit “Copy Link to Tweet”: instead of using status in the URL slug, it uses statuses, which seems to be the reason behind erroneous redirecting on mobile devices.

We’ve come to the conclusion that we want to be able to easily copy URLs and turn them into links based on Tweetbot’s URL scheme. Using a simple tweetbot:// URL, you can use Twitter’s status ID – the same you receive when you copy a link – to open a single tweet directly in Tweetbot. And the best part is, the same URL scheme works consistently across Tweetbot for iOS and Tweetbot for Mac. As everyone on the MacStories team is already using Tweetbot, the solution seemed obvious – plus: no more browser tabs.

The problem was finding a way to convert URLs easily, without having to remember complex combinations of keystrokes and commands. Furthermore, as I promised my team I’d come up with a way, I had to figure out a solution to do text conversion directly on iOS.

As a result, I’ve come up with an AppleScript, a Keyboard Maestro macro, and a simple Python script to transform Twitter URLs into their Tweetbot counterparts. Read more

Automatically Send Articles From Reading List to Instapaper

Two days ago, Ben Brooks asked on if anyone had come up with a way to share Safari Reading List items to Instapaper. His question made me realize that it would be a fun project to find out, so in my free time I put together a workflow that runs automatically and in the background on my Mac mini.

Please note, what follows is a raw experiment. I have tested it, and it works, but it’s far from stable. It uses GUI scripting in AppleScript to mark Reading List items as read, and it heavily depends on iCloud, which, unfortunately, is far from reliable when it comes to bookmark syncing. Nothing should happen to your bookmarks (the script simply “reads” them), but backups are recommended, as usual. Read more

Visualize OmniFocus As iThoughts Map, OPML, Or Plain Text

iThoughts for OmniFocus

iThoughts for OmniFocus

A few weeks ago, Michael Schechter found a way to export an OmniFocus for Mac database to OPML to visualize it in mind-mapping apps like iThoughts and MindNode. In the post, he wrote that, however, he was reaching to the Mac community to see if anyone would be able to build a more powerful and reliable solution with filters, color options, and more control on the exported data. RobTrew picked up the task and, on the OmniGroup Forums, released an initial script to export from OmniFocus to OPML.

Then, yesterday, Rob released a new version of the script which adds native iThoughts support and plain text exporting options, as well as settings for colors, templates, and filters.

I tested Rob’s script with my OmniFocus database, and after several improvements he made to the script, I feel comfortable enough with linking to it here. Unlike other solutions, Rob’s script looks directly into the SQL OmniFocus database cache to get its data – quite a feat on its own. But there’s so much more the script can do if you start customizing it. Read more