HighlanderSword Posted October 10, 2019 Share Posted October 10, 2019 Hello, When using NewMailEx, it does not appear to capture every new email that comes in on a Outlook Exchange email account. I'm trying to capture any new emails and then process a set of rules against the new emails , and taken action based on specific details of the emails. The Process seems to capture 1 or 2 messages but then misses the next email that appear in inbox right after the others do. Below is snippet of the code I'm using , any suggestions on what I'm Missing Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") Func oOApp_NewMailEx() Process_Rules() ; Function that parses the emails and takes the appropaite actions EndFunc Link to comment Share on other sites More sharing options...
water Posted October 10, 2019 Share Posted October 10, 2019 How fast do the mails come in (1 per minute, 50 per second ...)? How long does it take to process a mail by function Process_Rules (0.01 seconds, 5 seconds ...)? Is there a blocking function in process-Rules (like a GUI, MsgBox ...)? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted October 10, 2019 Author Share Posted October 10, 2019 Email come in like 5 per seconds , then nothing for a few minutes , then more email takes less than 1 second to process the email no gui in Process rules function it just process the emails , no msgbox etc.... Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 10, 2019 Moderators Share Posted October 10, 2019 Moved to the appropriate forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted October 10, 2019 Moderators Share Posted October 10, 2019 (edited) 1 hour ago, HighlanderSword said: Email come in like 5 per seconds , then nothing for a few minutes , then more email takes less than 1 second to process the email no gui in Process rules function it just process the emails , no msgbox etc.... The point I believe @water was trying to subtly make is that you're asking for help fixing a script but don't post enough of said script for us to do that. That function could be doing any number of things that could be changed to improve performance. So we are left to first guess at what you're doing and then try to troubleshoot. It makes it a whole lot easier on everyone if you post either your script or, if it is too long or has sensitive data, a reproducer that demonstrates the issue. Help us help you Edited October 10, 2019 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
water Posted October 10, 2019 Share Posted October 10, 2019 AFAIR there could be a problem when too many mails arrive while the function is already busy. Will have to ask Google ... My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted October 11, 2019 Share Posted October 11, 2019 Good (but maybe a bit outdated) reading: https://www.add-in-express.com/creating-addins-blog/2011/10/03/outlook-newmail-event/ My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted October 11, 2019 Share Posted October 11, 2019 (edited) I think the solution can be found here:https://docs.microsoft.com/en-us/office/vba/api/outlook.application.newmailex and https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2003/aa171304(v=office.11) (Outlook 2003 but better wording, including an example). Quote Occurs when one or more new items are received in the Inbox. This event passes a list of entry IDs of all the items received in the Inbox since the last time the event was fired. The entry IDs are comma-delimited. Edited October 11, 2019 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted October 11, 2019 Share Posted October 11, 2019 The script should look similar to this: #include <OutlookEX.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook NewmailEX event when one/multiple new mail(s) arrive(s). ; This script loops until Shift-Alt-E is pressed to exit. ; ***************************************************************************** HotKeySet("+!e", "_Exit") ;Shift-Alt-E to Exit the script MsgBox(64, "OutlookEX UDF Example Script", "Hotkey to exit the script: 'Shift-Alt-E'!") Global $oOApp = ObjCreate("Outlook.Application") Global $test = ObjEvent($oOApp, "oOApp_") While 1 Sleep(10) WEnd ; Outlook 2007 - NewMailEx event - http://msdn.microsoft.com/en-us/library/bb147646%28v=office.12%29.aspx Func oOApp_NewMailEx($sEntryIDs) ConsoleWrite("OutlookEX UDF Example Script - New mail has arrived!" & @CRLF & @CRLF) Local $oItem, $aEntryIDs = StringSplit($sEntryIDs, ",", $STR_NOCOUNT) For $i = 0 To UBound($aEntryIDs) - 1 $oItem = $oOApp.Session.GetItemFromID($aEntryIDs[$i], Default) ConsoleWrite("From: " & $oItem.SenderName & @CRLF & _ "Subject: " & $oItem.Subject & @CRLF) Next EndFunc ;==>oOApp_NewMailEx Func _Exit() Exit EndFunc ;==>_Exit FrancescoDiMuro 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
HighlanderSword Posted October 11, 2019 Author Share Posted October 11, 2019 Thanks, I will apply those changes and see how it goes, Many Thanks Water for your Help Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now