1

I would like to make message pop-up in Autohotkey when there is new message in Outlook. I have tried to use ComObjActive("Outlook.Application") with no joy. Also documentation for COM objects is pretty vague on Autohotkey site. Message should be like msgbox New Mail Received. This is similar to default message pop-up in Outlook. I just need this in AHK.

Main reason is that I'm using Desktops from Sysinternals. This program makes 4 separated desktops. When I run outlook on one desktop, I can't see new message pop-up from outlook on the other desktop. I need a simple AHK script that will tell me when there is a new mail, when I'm on different desktop than the one that is running Outlook.

IGRACH
  • 3,506
  • 6
  • 33
  • 48
  • A little confused. As I know, A Desktop Alert is a notification that appears on your desktop outlook when you receive a new email message. So why you want to should be the another pop-up? – Simon Li Oct 31 '18 at 02:58
  • Because I need pop-up in AHK when mail is received. – IGRACH Oct 31 '18 at 12:09
  • In Outlook, create VBA macro triggered on arrival of the e-mail which will use command line to call your AHK code with appropriate command-line parameters. Each of these steps is a separate area which you might want to explore better. – miroxlav Nov 02 '18 at 18:17
  • @miroxlav. That is like last resort. If there is no way to do it in AHK alone. – IGRACH Nov 02 '18 at 18:19

2 Answers2

0

In the System-StatusBar, their is an icon of outlook, which changes\animates for sometime when a new mail is received. We can use AutoHotKey > ImageSearch/PixelSearch for the same to find the difference.

  • Add a SetTimer with ImageSearch/PixelSearch.
  • Compare and If difference is found >> You Got A Mail.

As Simple As That. If you need futher help with Scripting, Please feel free :)

Hope this Helps :)

Arif Diggi
  • 69
  • 1
  • 2
  • 11
  • Outlook is running only on one desktop. There is no outlook icon on system tray. – IGRACH Nov 07 '18 at 21:46
  • It will be hidden in the menu >> in system-tray >> Show Hidden Icons, there you will find it (it will be an icon > pointing upwards) – Arif Diggi Nov 09 '18 at 12:28
  • Also check > https://stackoverflow.com/questions/11263483/how-do-i-trigger-a-macro-to-run-after-a-new-mail-is-received-in-outlook?rq=1 – Arif Diggi Nov 09 '18 at 12:31
0

I'm not used to AHK but after some research I came up with the following AHK script which should do what you need:

oOutlook = ComObjActive("Outlook.Application")
ComObjConnect(oOutlook, "outlook_")
return

outlook_NewMail() ;uses the COM event NewMail
{
    msgbox New Mail Received
    oOutlook.Visible := 1  ;make Outlook visible
    oOutlook.Activate      ;and bring to front
}

To stop listening to the outlook COM events use

ComObjConnect(oOutlook)
LostPhysx
  • 3,573
  • 8
  • 43
  • 73