Permalink
Browse files

added beginnings of applescript

  • Loading branch information...
1 parent d3015f1 commit 0c5b3e3249358ea5a1dfebe346b14d1c35b0db74 @tyler-dodge committed May 4, 2012
Showing with 21 additions and 3 deletions.
  1. +1 −1 .gitignore
  2. +20 −2 hashcal.py
View
@@ -1,4 +1,4 @@
*.pyc
*.dat
*.ics
-*~
+build/
View
@@ -41,7 +41,25 @@ def write_ics(filename, start, end, description):
file = open(filename, 'w')
file.write( ical.serialize() )
file.close()
-
+def write_appleScript(name,start, end, description):
+
+ script = "".join((
+ 'tell application "iCal"\n',
+ 'set theCalendarNames to title of every calendar\n',
+ 'set cal to item 1 of theCalendarNames\n'
+ 'end tell\n',
+ 'tell application "iCal"\n',
+ 'tell calendar cal\n',
+ 'make new event at end with properties\n',
+ '{description:"%s",\n' % description,
+ 'summary:"%s",\n' % description,
+ 'start date:"%s",\n' % start,
+ 'end date:"%s",\n' % end,
+ 'event:true}\n',
+ 'end tell\n',
+ 'end tell\n'))
+ print script
+ os.system("osascript <<< '%s'" % script)
class HashCal(object):
def __init__(self, source_file=None):
@@ -75,7 +93,7 @@ def add_item(self, options, tags, description):
print start,end
self.events.append( { 'start': start, 'end': end, 'text': description })
write_ics('test.ics', start, end, description)
-
+ write_appleScript("",start,end,description)
@file_check
def load_from_file(self, file_name):

0 comments on commit 0c5b3e3

Please sign in to comment.