I'm using an AHK Version 1.1.30.01 to distribute emails in Outlook to many different target folders via COM.
The target folders are determined via hotstrings, which the user enters into an inputbox.
This is the label that does all the moving:
Code: Select all
MoveEmail: ;Moves message to specified folder
If (OutlookModule = 1) ;If the Outlook module setting is set to 1 in the .ini file
{
IfWinExist, Move messages ahk_exe AutoHotkeyU32.exe
WinClose, Move messages ahk_exe AutoHotkeyU32.exe
olApp := ComObjActive("Outlook.Application")
olNameSpace := olApp.GetNamespace("MAPI")
olDestFolder := olNameSpace.Folders(MyEmail).Folders(OutlookArchive).Folders(Subfolder)
olEmails := olApp.ActiveExplorer.Selection
For olEmail in olEmails
olEmail.Move(olDestFolder)
LastMessage = Item moved to \\%MyEmail%\%OutlookArchive%\%Subfolder%
ToolTip, %LastMessage%
SetTimer, KillToolTip, -%ToolTipDuration%
}
Return