Add Scripts to Pythonista from Gists

Every time I share a Python script I do via Github gists, they're easy to maintain and are created directly from Pythonista. I used an script by Ole Zorn, the developer of Editorial and Pythonista, to create scripts from gist links in my clipboard. Pythonista 2.0 got an action extension and I thought it would be a great idea to improve such essential utility.

The script has the same limitations as the original, only working on single-files with the .py extension hosted as Github Gists. The original version opens the script after creation with the editor module, which is unavailable from the extension, so we display a HUD alert confirming the script was added successfully.

Further changes in the process to handle conflicts in the file name: the original script would append a suffix and create a new file, meanwhile the new version prompts to rename or replace the file. I did this because the suffix behavior is default of the command ran from the editor module, unaccessible from the extension, so this is supposed to streamline the experience across the multiple contexts where this utility is accessible.

Time for the last Pythonista gist you'll ever need to copy and paste in the app.

New from Gist

Adds Python gists as scripts on Pythonista. Based on Ole Zorn original action to support the new action extension.

View Script

At first the script won't show in the extension, so while at the extension tap the Edit button in the top-left corner. You got a button with a plus sign after the default scripts, tap it and you'll go to the Script Library to pick the script you want to add. After selecting it you can edit the entry, change title, set arguments and tweak the icon. Then you're set.

You can find some Pythonista scripts to put the script at test in the Actions page, including the script to OCR business cards for Interact.