Last active
April 17, 2020 08:51
-
-
Save jbwhaley/5898291 to your computer and use it in GitHub Desktop.
A tweaked version of Federico Viticci's [workflow for sending clipped text and a URL to Drafts.app](http://www.macstories.net/stories/automating-ios-how-pythonista-changed-my-workflow/).
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
import sys | |
import webbrowser | |
import console | |
import urllib | |
numArgs = len(sys.argv) | |
base = 'drafts://x-callback-url/create?text=' | |
if numArgs == 3: | |
clip = sys.argv[2] | |
link = sys.argv[1] | |
if clip =="": | |
text = "[from](" + link + "):" + "\n" + "\n" | |
text = urllib.quote(text, safe='') | |
else: | |
text = "[from](" + link + "):" + "\n" + "\n" + "> " + clip | |
text = urllib.quote(text, safe='') | |
else: | |
text = console.input_alert('Drafts', 'Enter your draft below') | |
text = urllib.quote(text, safe='') | |
webbrowser.open(base + text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment