Last active
February 8, 2019 13:02
-
-
Save hiilppp/6139407 to your computer and use it in GitHub Desktop.
Python script to sort lines of text in Pythonista and send them (back) to Drafts.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To call script from Drafts, use the follwing URL as URL Action: | |
# <pythonista://sort?action=run&argv=[[draft]]> | |
import sys | |
import urllib | |
import webbrowser | |
a = sys.argv[1].split("\n") | |
a.sort(key=str.lower) | |
a = "\n".join(a) | |
webbrowser.open("drafts://x-callback-url/create?text=" + urllib.quote(a)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cf. "Sorting with Pythonista" by @drdrang: http://www.leancrew.com/all-this/2013/08/sorting-with-pythonista/