2017-10-04 137 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