MS Outlook goto Send Items and Run Rules every 4 hours

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
mm6
Posts: 1
Joined: 30 Jun 2022, 10:50

MS Outlook goto Send Items and Run Rules every 4 hours

Post by mm6 » 30 Jun 2022, 11:09

Hi
RE: MS Outlook goto Send Items and Run Rules every 4 hours
In short I am so bad at this. I have searched for weeks trying to find a script and make it all come together, even the bits I get right failed when I try to put them together so I am too embarrassed to show what I have tried.
I have multiple folders for each claim/client.
I set rules for incoming emails that automatically go to folders I create based on various subject references.
the problem is every few hours I must go to the sent items folder and manually run the rules so that the rules I have created will sort all the sent emails also into the respective folders.
we work on MS exchange off a single email, so my buddies need me to get the sent items into there folders regularly (also am out the office for meetings).

from what I see it needs the following:
1. loop - every 2 hours it should run (prefer during 6am and say 10pm)
2. goto Outlook window (and not be bugged if I am busy on another window - happy if I am overruled by this script)
3. run the VBA macro t goto send folder I created
4. run a second vba macro that runs rules that i created

1. Loop - yoah!! tough
no ideas how I will employ this

2. goto Outlook window
I have tried the following with partial success

Code: Select all

Process, Exist, OUTLOOK.exe
If (!ErrorLevel){
   Run OUTLOOK.exe              
   WinWait, ahk_exe OUTLOOK.exe
}
WinActivate, ahk_exe OUTLOOK.exe
Return
#IfWinActive ahk_exe OUTLOOK.exe
{
Send !6 [alt6 is a shortcut to the VBA script that is on quick access toolbar]
}
#IfWinActive
[Mod edit: [code][/code] tags added.]

3. run the VBA macro to go to send items folder
Send !6 [alt6 is a shortcut to the VBA script that is on quick access toolbar = works great]

4. run a second vba macro that runs rules that i created
Send !5 [alt5 is a shortcut to the VBA script that is on quick access toolbar that runs rules = works great]

apologies in advance
Mike

BoBo
Posts: 6564
Joined: 13 May 2014, 17:15

Re: MS Outlook goto Send Items and Run Rules every 4 hours

Post by BoBo » 02 Jul 2022, 05:21

Hi Mike,
I guess the "Outlook-part" should be handled using AHK's ComObj with the additional benefit that it's fully background compatible.
Besides that, I'd expect that (the majority of) the VBA tasks can be handled with AHK too. Any problem with providing its code?

TBH, I'm a bit confused that the mail filter that is managing the file distribution into your colleagues' folders needs some manual intervention? :think:
loop - every 2 hours it should run (prefer during 6am and say 10pm)

Code: Select all

#SingleInstance, Force
#Persistent

SetTimer, checkMail,% 2*60*60*1000 ; 2h
return

checkMail:
   if A_Hour between 6 and 22
   	{
	MsgBox % "Here we go. Let's do it!" ; here you'll add your tasks instead
	}
   return

F11::SetTimer, checkMail, On
F12::SetTimer, checkMail, Off

Post Reply

Return to “Ask for Help (v1)”