0

我从 AHK 论坛获得了这个代码片段,我希望我只是缺少一行代码来取得成功。我想让用户在 INPUTBOX 中输入字符串。然后我想遍历特定邮箱中的所有电子邮件——比如“Deliveries”——当它找到包含该字符串的 txt 时,在继续循环中的下一个 msg 之前采取某些操作。

帮助?

Loop, 10 {
; Loop through all the MailItems in the Inbox Folder
  MailItems := Folders.item("Deliveries").Items
  Loop, % MailItems.Count {
   Item := MailItems.item(A_Index)
    {
    ; Add code to copy txt of each msg into a var
    ; Check if that var CONTAINS the specified string and act accordingly 
    msgtxt: = Item.Body ????
    }
4

1 回答 1

1

由于我没有运行 Outlook(假设那是电子邮件客户端),因此我创建了一些伪代码进行尝试。不确定这是否会正常运行。我添加了Alt+F12来启动它。

!F12::
InputBox, MySearchString, Search, Please enter a search string.
Loop, 10 ; Loop through the MailItems in the Deliveries Folder
{
    MailItems := Folders.item("Deliveries").Items
    Loop, % MailItems.Count
    {
        EmailText = MailItems.Body
        EmailSubject = MailItems.Subject
        IfInString, EmailText, %MySearchString%
        {
            MsgBox, The string: %MySearchString% was found in message: %EmailSubject% .
            return
        }
    }
}
于 2013-03-01T12:15:29.313 回答