water Posted February 17, 2020 Share Posted February 17, 2020 Does this mean you modified your script or the OutlookEX UDF? 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...
devilburnz Posted February 18, 2020 Author Share Posted February 18, 2020 oh my script, i edited abit to allow the attachments[2] equal to an specific 2d array and also for the error i have overlook, the error which is correct as my mouse click function click on an email with no attachment which suppose to be correct. Link to comment Share on other sites More sharing options...
water Posted February 18, 2020 Share Posted February 18, 2020 I see. So there is no need to update my OutlookEX UDF devilburnz 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...
devilburnz Posted February 19, 2020 Author Share Posted February 19, 2020 yeah you are the expert. hehe Just to check with you, i have a 3rd party program installed in outlook, there will be an addition text added in mailsubject title and mailbody message whenever the send/reply/forward etc mail button is hit. with just the codes, subject and body (eg mailbox.subject), it does not capture the addition text. What i am trying to achieve is when the send button is hit, the addition text will be capture in subject and body as well, so the result can be display in my 2d arraylist. can this possibly be done? Link to comment Share on other sites More sharing options...
water Posted February 19, 2020 Share Posted February 19, 2020 To act on the send button you need to use "Events". Please have a look at my OutlookEX example scripts thread, example: _OL_Example_SentMail_Event.au3 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...
devilburnz Posted February 20, 2020 Author Share Posted February 20, 2020 saw your example scripts but the scripts event has to check the send folder, i am actually automating in offline so the mail messages are probably siting in outbox. so just checking are there any other options to check the sent message without checking folders? do we have other events or methods to check on subject and body via the send buttons? Link to comment Share on other sites More sharing options...
water Posted February 20, 2020 Share Posted February 20, 2020 The send event of the mailitem would be another option (which I have not used yet): https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.send(even) 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...
devilburnz Posted February 21, 2020 Author Share Posted February 21, 2020 hmmm any idea how to does the send event call? i am getting empty data display in the array global $outlook = _OL_Open() global $mailitem = $outlook.mailitem $mailitem = $outlook.ActiveInspector.CreateItem() $mailsubject = $mailitem.subject.send $array[$i][5] = $mailsubject _Arraydisplay($array) Link to comment Share on other sites More sharing options...
water Posted February 21, 2020 Share Posted February 21, 2020 This example script grabs all "Send" events, checks for mails and modifies the subject before sending the mail. #include <OutlookEX.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook event when a new item is being sent. ; This script checks for mail items and changes the subject before the mail is ; being sent. ; 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 $oApp = ObjCreate("Outlook.Application") Global $oEvent = ObjEvent($oApp, "_oItems_") While 1 Sleep(50) WEnd ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Volatile Func _oItems_ItemSend($oItem, $bCancel) #forceref $bCancel $bCancel = False If $oItem.Class = $olMail Then $oitem.Subject = "Modified by AutoIt script: " & $oitem.Subject $oItem.Save() EndIf EndFunc ;==>oItems_ItemSend Func _Exit() Exit EndFunc ;==>_Exit 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...
devilburnz Posted February 24, 2020 Author Share Posted February 24, 2020 (edited) Thanks water, you're a genius. however, when i click on send button, i have installed a 3rd party program that will prompts and do some action before the mail is sent out. hence, somehow or rather from the 3rd party program running, i am unable to return email message body $mailitem.body from outlook to msg box nor array, any advise? it is blank. The script above works if the handler runs without the 3rd party program prompts. i could get the return email message body. $array[$i][1] = $mailitem.subject $array[$i][2] = $mailitem.body $hashsubject = _crypt_hashdata($mailitem.subject,$CALG_MD5) $hashbody = _crypt_hashdata($mailitem.body,$CALG_MD5) $array[$i][3] = $hashsubject $array[$i][4] = $hashbody $mailitem.save() _Arraydisplay($array) Edited February 24, 2020 by devilburnz Link to comment Share on other sites More sharing options...
water Posted February 24, 2020 Share Posted February 24, 2020 Did you try the HTMLBody property? 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...
devilburnz Posted February 24, 2020 Author Share Posted February 24, 2020 yup just tried, i able to return some message like this in the <Body> <!-- converted from text format--> </Body> which apparently it isn't the message body. Link to comment Share on other sites More sharing options...
water Posted February 24, 2020 Share Posted February 24, 2020 Seems the plugin interferes with the event handler. Hard to tell how to solve this problem. Can you please tell me what you try to do with your script? Maybe there is a better way to do what you want to do ... 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...
devilburnz Posted February 24, 2020 Author Share Posted February 24, 2020 oh i trying to send an email so what written by the user in the subject and mail body should be stored into array. Link to comment Share on other sites More sharing options...
water Posted February 24, 2020 Share Posted February 24, 2020 Quote oh i trying to send an email so what written by the user in the subject and mail body should be stored into array. Idea 1: Add another recipient so you get a copy of the sent mail. Idea 2: Create an Outlook rule that creates a copy of the mail when some conditions are met (see _OL_RuleAdd.au3 for an example) 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...
devilburnz Posted February 25, 2020 Author Share Posted February 25, 2020 (edited) 16 hours ago, water said: Idea 1: Add another recipient so you get a copy of the sent mail. Idea 2: Create an Outlook rule that creates a copy of the mail when some conditions are met (see _OL_RuleAdd.au3 for an example) Maybe a little hard. i have figured out my outlook behavior, when the send button is clicked, the 3rd party program auto starts and it takes about 3-5 seconds for the message body to goes blank and the mail will be send after. so after the send click starts, it probably my chance to capture the message body and store it quickly without update the array. so just checking can the event handler capture the information after the send button is click within 3-5 seconds and stores the message body into array without updating the message/array after the mail has send out? Edited February 25, 2020 by devilburnz Link to comment Share on other sites More sharing options...
water Posted February 25, 2020 Share Posted February 25, 2020 The script I posted above at maximum delays the processing of the event by 50 milliseconds. So the processing should be done within the 3-5 seconds you mentioned. Can you please post your script so I can check if there are any further delays? 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...
devilburnz Posted February 25, 2020 Author Share Posted February 25, 2020 (edited) when the 3rd party program pops out, the program will add the additional text to the mail body(which is i want to capture the mail body text). 4-5 seconds later, the 3rd party running program pops out auto exit, the mail body message changes to blank and mail is send out all together simultaneously. i did try to put up the delay up to 8 seconds and i don't think the issue of delay will help because when the 3rd party program and new mail exits, the mailbody will be updated to blank. my sample codes is below Global $oApp = ObjCreate("Outlook.Application") Global $oEvent = ObjEvent($oApp, "_oItems_") global $array[1][2] sendmail() _arraydisplay($array) Func sendmail() ; the new email is opened send("mail testing") sleep(8000) controlclick("Untitled","","Button1") ;This is the action to trigger the send event Endfunc ; Outlook 2007 - ItemSend event - http://msdn.microsoft.com/en-us/library/bb147641%28v=office.12%29.aspx Volatile Func _oItems_ItemSend($oItem, $bCancel) #forceref $bCancel $bCancel = False If $oItem.Class = $olMail Then $array[$i][2] = $oItem.body $oItem.Save() EndIf EndFunc ;==>oItems_ItemSend Edited February 25, 2020 by devilburnz added arraydisplay Link to comment Share on other sites More sharing options...
water Posted February 25, 2020 Share Posted February 25, 2020 The Send(8000) does not help because the send event gets triggered with the conrolclick. I would add myself to the recipients. Add a second script to wait for a newmail event and process the subject and body from this mail in the inbox. You can identify this mail by the text that gets added by your plugin. 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...
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