phuocvo88 Posted October 21, 2021 Share Posted October 21, 2021 I've read some threads and noticed that there is a UDF written by Water but it doesn't fit my desire. Water's UDF seems to run actions with Outlook in the background, I didn't see Outlook started up. What I need is actual user's interactions on the UI of Outlook. For example: 1. start an instance of Outlook app 2. Click New Email 3. Click the attach File button 4. Select one or some files to attach to the email. The reason I need to do all these actions in UI is that I need to check the status of a plug-in which will read the attachment to find for a string pattern. - if string is found the plug in icon turn red - if not, icon stays green. With Water's UDF I can't check the status of that plug-in icon as everything is running in background Can some one help me with the script to add attachments for new Email in Outlook Link to comment Share on other sites More sharing options...
water Posted October 21, 2021 Share Posted October 21, 2021 I think this should be possible with my UDF. Create the mail item using $oItem = _Ol_ItemCreate $oItem.Display The user then can add attachments as he likes. phuocvo88 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...
phuocvo88 Posted October 26, 2021 Author Share Posted October 26, 2021 On 10/21/2021 at 3:39 PM, water said: I think this should be possible with my UDF. Create the mail item using $oItem = _Ol_ItemCreate $oItem.Display The user then can add attachments as he likes. I'll try this Link to comment Share on other sites More sharing options...
phuocvo88 Posted October 28, 2021 Author Share Posted October 28, 2021 On 10/21/2021 at 3:39 PM, water said: I think this should be possible with my UDF. Create the mail item using $oItem = _Ol_ItemCreate $oItem.Display The user then can add attachments as he likes. Could you please help me a little bit with your UDF. For a simple scenario: 1. open the Outlook mail composer 2. add an attachment (attachment dir = @ScriptDir & "\The_Outlook.jpg) 3. Display the mail composer so that I can check a plugin status in ribbon section.( it will scan the attachment and change status red/green/yellow accordingly) I've read you OutlookEX UDF but I don't understand how to pass parameters in. #include <OutlookEX.au3> ; ***************************************************************************** ; Example Script ; Handle Outlook Quit event when Outlook is being closed. ; 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 $oOL = _OL_Open() $iPID = ProcessExists("OUTLOOK.EXE") ConsoleWrite("PID of Outlook = " & $iPID) $oItem = _OL_ItemCreate $oItem.Display _OL_ItemAttachmentAdd($oOL, @ScriptDir & "\The_Outlook.jpg") Sleep(10000) While 1 Sleep(10) WEnd ; Quit event - https://docs.microsoft.com/en-us/office/vba/api/outlook.application.quit(even) Func oOApp_Quit() MsgBox($MB_ICONINFORMATION, "OutlookEX UDF Example Script", "Outlook is being closed!" & @CRLF & "Goodby ") EndFunc ;==>oOApp_NewMailEx Func _Exit() Exit EndFunc ;==>_Exit I got the error called with wrong number of args as seen in attachment Link to comment Share on other sites More sharing options...
water Posted October 30, 2021 Share Posted October 30, 2021 First we need answers to a few questions before we can decide how to use AutoIt and the OutlookEX UDF. Who is going to start the AutoIt script: The user? Windows autostarts the script when the user logs on? ... How often should the script be run? Just one time and then the user has to start start it again? In a loop until the user logs off? ... The files to attach are all defined in advance or should the user be able so select all or some additional attachments himself? The script creates a new mail item, attaches file(s) and displays the "mail composer". How do you determine that the user has finished the mail? By clicking the send button? When the status of the plugin icon changes? ... Skysnake 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...
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