THIS WEEK'S SPONSOR:

FitnessView

All-in-One Health & Fitness Dashboard


Posts tagged with "pythonista"

Send Multiple Tasks To OmniFocus Mail Drop At Once With Drafts and Pythonista

Send Multiple Tasks To OmniFocus Mail Drop At Once With Drafts and Pythonista

Nice workflow by Nathan Henrie to send multiple tasks to OmniFocus at once using Mail Drop, Drafts, and Pythonista:

I’ve also recently started playing with Pythonista, and I came across a Python script written by the dev himself that creates a little SMTP server and sends email directly from Pythonista. Between the two, I found it pretty easy — even for a beginner like me — to put together a combined Drafts / Pythonista workflow that makes for a superior way to import a bunch of tasks to OmniFocus at once (aka “brain dump”).

The Python part is based on the same script I covered in November to send emails through Pythonista; Nathan added a clever Drafts integration by splitting multiple lines (from the draft) into separate email messages sent to your Mail Drop address. Make sure to check out his video to see the workflow in action; I have started using it myself and I like how fast tasks go from Drafts onto OmniFocus via email (I have configured the script with my Gmail address using 2-step verification).

I have become a big fan of OmniFocus Mail Drop. It’s been extremely fast and reliable in my experience, and it works well with Drafts’ email actions.

Permalink

Create and Share Evernote Notes With Pythonista On iOS

I use Evernote on a daily basis, but there’s no easy and quick way to create new notes and receive their shared URLs on iOS. While I tend to prefer plain text files, Evernote notes are quite useful when I need to share rich text (containing formatting and inline images) with someone else. Sharing via the official Evernote app takes too long[1], and I don’t like the UI of other Evernote clients.

Yesterday, Pythonista developer Ole Zorn posted an installer script for the Python Evernote SDK. By putting together all the necessary dependencies, he created an installer script that will create an “evernote-sdk” sub-folder in Pythonista 1.3; with that, you’ll be able to access the entire Evernote API to create and manage notes – all while taking advantage of the uniqe iOS-related features of Pythonista.

Inspired by Ole’s demoes and the snippets posted by Brett Kelly in the past weeks, I created a script that does exactly what I need: it lets me enter text to save it in an Evernote note that will be shared publicly. If triggered by an app like Drafts or Launch Center Pro, the script will take the text sent by those apps. If formatted in Markdown, the text will be converted to HTML before saving it to Evernote. Read more


Pythonista 1.3 Brings Camera Roll and Notification Center Support, New Library View, And More

Ole Zorn’s Pythonista is one of my favorite, most-used iOS apps to date. Combining a Python interpreter with scripting capabilities that take advantage of iOS through native interface elements and features like URL schemes, Pythonista has completely reinvented my iOS workflow. With Pythonista, I can work from the iPad without wishing I had a Mac.

Back in November, I wrote an extensive review of Pythonista 1.2, providing some sample scripts and an in-depth look at the app and its functionalities. I concluded my review saying:

I believe that, going forward, Pythonista and other similar apps will show a new kind of “scripting” and task automation built around the core strenghts of iOS.

Pythonista 1.3, released today, adds a number of features aimed at making the app more “connected” with the underpinnings of iOS, enabling users to create more complex workflows that go beyond running scripts inside Pythonista. I was able to use Pythonista 1.3 for the past weeks, and I believe it’s a very solid update. Read more


Chaining Tweetbot, Pythonista, Drafts, and iMessage for URLs

DraftsMessages

DraftsMessages

Last night, Tweetbot for iOS was updated with support for the Twitter 1.1 API, which, among various requirements, includes the need of linking a tweet’s timestamp – the date and time when it was sent – to its unique URL on twitter.com. In Tweetbot, you can now open the tweet detail view and tap on the timestamp to automatically open the Twitter website in your default browser; in terms of interaction, I like this change because it lets me open tweets in Google Chrome with just one tap.

In thinking about the update last night, I realized that:

  • My team and I use iMessage for daily communication;
  • The majority of URLs we share are Twitter URLs;
  • We all use Tweetbot on iOS and OS X;
  • Easier browser access means easier bookmarklet triggering;
  • Drafts can access iMessage.

And I concluded that:

  • I could chain every piece of the puzzle together;
  • Hopefully somebody else will find it useful and adapt the workflow to other similar scenarios.

Therefore, I created a browser bookmarklet, a Python script, and a Drafts action to automate the entire process and demonstrate how you can convert Twitter URLs to tweetbot:// URLs and send text from Pythonista to Drafts.

As usual, I am posting the following workflow as a proof of concept that you can modify and adapt to your needs. For instance, you can change the action that is triggered in Drafts, the x-success parameter that will be triggered, or the way Twitter links are converted to Tweetbot-specific URLs.

Read more


iOS YouTube Downloader with Pythonista

iOS YouTube Downloader with Pythonista

Useful script created by “pudquick” on the Pythonista forums:

Browse to http://m.youtube.com in Mobile Safari, view a video that you like (press Stop if it starts playing, you need to be looking at the page - not the video actually playing), then click on “Bookmarks” and select the bookmarklet that you created.

This will launch my script, which will pull the URL of the page you were looking at as an argument, parse it, figure out the direct download URL for the .mp4 video file, then open iDownloads directly to that URL to start downloading it.

As pudquick says, third-party YouTube clients with a “download” functionality are usually removed from the App Store as Google doesn’t allow downloading video files from the service. However, by using Pythonista to crawl the webpage and find the direct .mp4 link of a video, pudquick managed to put together a handy solution to go from your web browser to Pythonista and then directly to iDownloads to start downloading the .mp4 file.

However, I don’t use iDownloads – I prefer Readdle’s Documents and good.iWare’s GoodReader. Replacing iDownloads with your favorite file manager is very easy: in the penultimate line of the script, replace the iDownloads://URL with the one of the app you want to use (the URL of the .mp4 will be appended to it). Unfortunately, Documents doesn’t seem to be able to download .mp4 files in this way, but I had no problems with GoodReader. Simply use ghttp://to forward the .mp4 file to GoodReader and start downloading it automatically.

Make sure to check out pudquick’s explanation of the script and bookmarklet here. For our previous coverage of Pythonista, check out our tag page and my original review.

Permalink

From Instapaper and Pythonista To Dropbox and Evernote As PDF

I’ve already expressed my preference for archiving webpages as PDFs rather than simple “bookmarks” on an online service. When I come across a webpage that I know I want to keep for future reference, I like to generate a clean-looking PDF file with selectable text that I can rely on for years to come.

Lately, I have become obsessed with turning longer articles I find on the Internet also into PDFs for long-term archival. For as much as I like Instapaper, I can’t be sure that the service will be around in the next decades, and I don’t want my archive of longform and quality content to be lost in the cloud. So I have come up with a way to combine Instapaper with the benefit of PDFs, Dropbox, and automation to generate documents off any link or webpage, from any device, within seconds.

Yesterday I put together an iOS and OS X workflow to generate PDFs remotely on my Mac, starting from a simple bookmarklet on iOS. On an iPhone or iPad, I can simply hit a button in Safari, and wait for Pythonista to turn a webpage (that’s already been passed through Instapaper’s text bookmarklet) into an .html file in my Dropbox, which is then converted to PDF and added to Evernote. It sounds complex, but in actual practice I can go from a Safari webpage on iOS to a PDF in the Evernote app in around 30 seconds. Hopefully you’ll find this quick solution useful; feel free to modify it and/or send suggestions. Read more


Home Automation With An iPad

Home Automation With An iPad

Here’s another interesting use case for my ongoing coverage of Pythonista. From the Pythonista Community Forums, user nlecaude shares a script and a demo video showing how he managed to control the lights in his house using Pythonista (thanks, Gabe).

The Pythonista app is pretty simple, it’s basically crossfading between different images to show the current state of the lights. I have one layer for each state (3 lights so 2^3) and I have invisible layers that I use as buttons to trigger the lamps and transition on and off. I’m quite fascinated by the possibilities of Pythonista.

If you watch the video below, it basically looks like magic. This guy is tapping on a photo of his room on an iPad to turn the actual lights on and off. In practice, he’s using a Python library to control a Philips Hue system that reacts to touch input from Pythonista.

For those unaware of Philips’ product, Hue is a personal wireless lightning system that can be remotely controlled and programmed to offer different lightning settings and color combinations for every occasion. Philips isn’t offering an SDK for developers yet, but the Python library manages to directly connect to the Hue wireless bridge and send input commands.

As nlecaude writes, this is just a script put together in 10 minutes with an unofficial library. The possibilities for home automation programmed from an iPad are seriously intriguing.

Permalink

Quickly Create Pythonista Shortcuts with Custom Icons

Quickly Create Pythonista Shortcuts with Custom Icons

Interesting set of scripts posted on the Pythonista Community Forums (which, by the way, are becoming a daily appointment for me as Pythonista users are coming up with all sorts of tricks). Using Pythonista as a web server and Safari, you can create local (and unsigned) .mobileconfig files to automate the installation of Pythonista webclip icons. As I explained in my review, Pythonista can launch specific scripts using webclips created from a special webpage:

Upon tapping, a Pythonista Home screen bookmark will briefly open a blank page and then immediately redirect to the script you’ve configured in the Pythonista app. I’m fairly certain there’s no way to avoid showing a blank page for a second before redirecting to Pythonista; fortunately, it’s really just the fraction of a second, as the redirecting process is instantaneous both on my iPad 3 and iPhone 5.

Using the scripts linked in the forums, I easily managed to create a custom icon for my Markdown-Poster workflow that uses Poster’s icon instead of the default Pythonista one. To extract and convert iOS icons for personal use, I recommend Crunch, which I’ve also previously reviewed. I was intrigued by how forum user pudquick figured out the installation of provisioning profiles from Pythonista:

When you run the code, it starts a web server in Pythonista - and copies the URL for the generated .mobileconfig file to the clipboard. When you switch to Safari and attempt to load the URL, the socket connects - but it’s waiting for communication from the web server in Pythonista (which is paused, since it’s in the background).

As soon as you switch back to Pythonista, this un-pauses the web server fast enough to cause Safari to finish loading the .mobileconfig file while it’s swapping to the background, which then triggers the installation screen!

Combining the script with this other one to easily generate base64 images, I suggest replacing Image.BILINEAR on line 20 with Image.ANTIALIAS for slower but better results in the overall crispness of the icon (I also changed the size to 114x114 for my Retina iPad).

Looking forward to improvements for Pythonista shortcuts (as mentioned by developer Ole Zorn in the thread), this is a nice stopgap solution to use scripts with custom shortcut icons in the Home screen.

Permalink

Quickly Email A Picture On iOS Using Pythonista

Quickly Email A Picture On iOS Using Pythonista

In my review of Pythonista yesterday, I didn’t include any scripts to send email messages. Email is, however, a huge part of my iOS workflow, as I often send screenshots back and forth with my teammates about upcoming site features or new apps I’m testing. Fortunately, Pythonista developer Ole Zorn shared today a script that uses smtplib to quickly send an image via email. His script is available on GitHub Gists here.

I have modified it slightly to import my login data using keychain and send an image that’s been previously copied to the clipboard. In this way, I can take a screenshot/photo, open the Photos app, copy it, and send it via email in seconds, at full-size. You can save the script as shortcut on your Home screen and have one-tap access to it, or, even better, you can copy images from Safari without saving them first to the Camera Roll (though, in my tests, this hasn’t always worked reliably). My modification also uses console.input_alert to let you enter a different email address and Subject every time, and it plays a sound effect when an email is sent. Right now, the ImageMail script works with Gmail, but it could be easily modified to work for other email services.

In a future version of Pythonista, I think it’d be neat to have a dedicated Address Book module to return contact fields such as email addresses or Twitter usernames; Ole suggests Reminders and Calendar integration might be handy as well. I think Pythonista has a very bright future, so we’ll see. In the meantime, you can download my modified version of the ImageMail script here.

Pythonista is available at $4.99 on the App Store.

Permalink