Skip to content

Instantly share code, notes, and snippets.

@derickfay
Last active August 20, 2016 13:57
Show Gist options
  • Save derickfay/10012120 to your computer and use it in GitHub Desktop.
Save derickfay/10012120 to your computer and use it in GitHub Desktop.
Sends the input text to Fantastical, converting TaskPaper @Due(YYYY-MM-DD) tags to plain text for Fantastical to parse as a Reminder. Designed for use with Drafts and Pythonista.
# tp2fantastical
#
# by Derick Fay, 2014-04-06
#
# an adaptation of the Selection to Fantastical Editorial workflow
# (http://editorial-app.appspot.com/workflow/6172238982152192/Y3VYajI3Hzc )
# for use with Drafts and Pythonista (both required)
#
# works on iPhone and iPad
# I have also written an equivalent script for TaskPaper for the Mac
# available at http://www.hogbaysoftware.com/wiki/ParseClipboardInFantastical
#
# installation:
# 1) copy this script into Pythonista and name it tp2fantastical
# 2) create a Drafts URL Action with the following URL:
# pythonista://tp2fantastical?action=run&argv=[[draft]]
#
import sys
import webbrowser
import urllib
i = sys.argv[1]
#i = "Test item @due(2014-05-14)"
if '@due(' in i:
theEnd=""
theStart=i.split('@due(')[0]
theDate=i.split('@due(')[1][0:10]
theEnd=i[(i.index('@due(')+16):]
i = theStart + " due " + theDate + theEnd
webbrowser.open("fantastical2://parse?sentence=" + urllib.quote(i))
@derickfay
Copy link
Author

2014-04-21: corrected Drafts action

@derickfay
Copy link
Author

added link to Mac version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment