ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ns_dev/Python/NinoCode/Active_prgs/COM/G2G.py
Revision: 8
Committed: Sat May 5 04:21:19 2012 UTC (13 years, 10 months ago) by ninoborges
Content type: text/x-python
File size: 1113 byte(s)
Log Message:
Initial Import

File Contents

# User Rev Content
1 ninoborges 8 ##This program automates the creation of my "Gone to Gym" calendar entry. This way i
2     ## won't forget to update my calendar.
3     #EBorges
4     #12.28.01
5    
6     from win32com.client import Dispatch
7     from win32com.client import constants
8     import time
9    
10    
11     def main():
12     global o
13     o=Dispatch("Outlook.Application.11")
14     print "Program started. Waiting 20 minutes."
15     starttime = ConvertDate() + ", 2007 03:00 pm"
16     endtime = ConvertDate() + ", 2007 4:00 pm"
17     #time.sleep(1200)
18     print "20 minutes have passed. Creating appointment."
19     CalendarEntry("Gone to gym","Capital Club",starttime,endtime)
20     print "Calendar Entry has been created."
21    
22     def CalendarEntry(sub,loc,starttime,endtime):
23     appointment = o.CreateItem(constants.olAppointmentItem)
24     appointment.Subject = sub
25     appointment.Location = loc
26     appointment.Start = starttime
27     appointment.End = endtime
28     appointment.Save()
29    
30     def ConvertDate():
31     now = time.localtime()
32     date = now[1]
33     date2 = now[2]
34     date = str(date) + " " + str(date2)
35     return date
36    
37    
38     if __name__ == "__main__":
39     main()