2017-10-04 64 views
1

我试图找出如何使用基于SubjectName的Autohotkey搜索特定约会。现在我有工作来展示最新的约会。Autohotkey Outlook日历搜索

olFolderCalendar := 9 
 
olFolderContacts := 10 
 
olAppointmentItem = 1 
 
         
 
profileName := "Outlook" 
 
Outlook := ComObjCreate("Outlook.Application") 
 
namespace := Outlook.GetNamespace("MAPI") 
 
namespace.Logon(profileName) 
 
calendar := namespace.GetDefaultFolder(olFolderCalendar) 
 
items := calendar.Items 
 
count := items.Count 
 

 
msgbox % "calendar items: " count 
 
item := calendar.Items(count) 
 

 

 
item1 := "subject: " item.Subject . "`n" 
 
item1 .= "Start: " item.Start . "`n" 
 
item1 .= "Duration: " item.Duration . "`n" 
 
item1 .= "Body: " item.Body "`n" 
 
msgbox % "item1" item1

在此先感谢。

回答

0

遍历,寻找它:

olFolderCalendar := 9 
olFolderContacts := 10 
olAppointmentItem = 1 

profileName := "Outlook" 
Outlook := ComObjCreate("Outlook.Application") 
namespace := Outlook.GetNamespace("MAPI") 
namespace.Logon(profileName) 
calendar := namespace.GetDefaultFolder(olFolderCalendar) 
items := calendar.Items 
count := items.Count 

msgbox % "calendar items: " count 

InputBox, testsubj, What Subject?, What Subject? 
Loop { 
    item := calendar.Items(count - A_Index + 1) 
    subj := item.Subject 
    IfEqual, subj, %testsubj% 
     break 
} 

item1 := "subject: " item.Subject . "`n" 
item1 .= "Start: " item.Start . "`n" 
item1 .= "Duration: " item.Duration . "`n" 
item1 .= "Body: " item.Body "`n" 
msgbox % "item1" item1 

H个,

+0

三江源PGilm!它像一个魅力 –

+0

@StefanBosman:好。请将其标记为已回答,然后(然后单击向上箭头以指示答案有用)。这有助于网站上的每个人。我“提出了”你的问题,因为它显示了研究工作,并且很清楚。谢谢!! – PGilm