Skip to content

Instantly share code, notes, and snippets.

@omz
Created November 30, 2012 17:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save omz/4177224 to your computer and use it in GitHub Desktop.
Save omz/4177224 to your computer and use it in GitHub Desktop.
Untitled 1
#coding: utf-8
# Original script by Federico Viticci:
# http://www.macstories.net/reviews/fantastical-for-iphone-review/
# Modified to work better with international characters
import webbrowser
import clipboard
import urllib
import console
when = clipboard.get()
fant = 'fantastical://parse?sentence='
newtask = console.input_alert('What is this?', 'Type your event below')
loc = console.alert('Location', 'Does the event have a location?', 'Yes', 'No')
if loc == 1:
place = console.input_alert('Where', 'Type your location below')
event = newtask.decode('utf-8') + ' ' + when + ' at ' + place.decode('utf-8')
encoded = urllib.quote(event.encode('utf-8'), safe='')
elif loc == 2:
event = newtask.decode('utf-8') + ' ' + when
print type(event)
encoded = urllib.quote(event.encode('utf-8'), safe='')
text = fant + encoded
webbrowser.open(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment