public
Last active

Untitled 1

  • Download Gist
Untitled 1.py
Python
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
#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)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.