televisi Posted April 27, 2016 Posted April 27, 2016 Hi, I'm trying to automate the Ms outlook pop-up, when an external application try to send an email using Outlook. This is what the pop-up window looks like: The following is the Window Info: expandcollapse popup>>>> Window <<<< Title: Microsoft Office Outlook Class: #32770 Position: 766, 393 Size: 359, 213 Style: 0x94C800CC ExStyle: 0x00010101 Handle: 0x00000000000405EA >>>> Control <<<< Class: Button Instance: 4 ClassnameNN: Button4 Name: Advanced (Class): [CLASS:Button; INSTANCE:4] ID: 4774 Text: Allow Position: 54, 151 Size: 75, 23 ControlClick Coords: 32, 14 Style: 0x50010000 ExStyle: 0x00000004 Handle: 0x000000000006058A >>>> Mouse <<<< Position: 855, 583 Cursor ID: 0 Color: 0x000000 >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< &Deny &Help A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date. For more information about e-mail safety and how you might be able to avoid getting this warning, click Help. Allow >>>> Hidden Text <<<< DAL=on &Allow access for The following is my code: #RequireAdmin #include <MsgBoxConstants.au3> #include <WinAPI.au3> Local $hWnd = WinWait("Microsoft Office Outlook", "",5) Local $hCtrl = ControlGetHandle($hWnd,"","[ClassNN:Button4]") ;Activate the Window WinActivate($hWnd) ;Click "Allow button" Local $hResult = ControlClick($hWnd,"Allow",$hCtrl,"primary",2) MsgBox($MB_SYSTEMMODAL, "", "hWnd result:" & $hCtrl & " - result: " & $hResult) And the following is the result: As you can see in the MsgBox; it found the "Allow" button and the ControlClick resulted with 1; but then nothing happen. Does anyone know the resolution for this? O/S: Windows 7x64 Thanks
televisi Posted April 27, 2016 Author Posted April 27, 2016 For your info, I'm using AutoIt v.3.3.14.2
Juvigy Posted April 27, 2016 Posted April 27, 2016 I think there are outlook settings that doesnt show those popups when you do .Send action. If you are interested i can look it up. I have implemented it in my Outlook and those popups dont show.
junkew Posted April 27, 2016 Posted April 27, 2016 https://support.office.com/en-us/article/I-get-warnings-about-a-program-accessing-e-mail-address-information-or-sending-e-mail-on-my-behalf-df007135-c632-4ae4-8577-dd4ba26750a2?CorrelationId=ab7e60d4-de43-48f4-ba9a-7a23786f755f&ui=en-US&rs=en-US&ad=US FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
televisi Posted April 27, 2016 Author Posted April 27, 2016 4 hours ago, junkew said: https://support.office.com/en-us/article/I-get-warnings-about-a-program-accessing-e-mail-address-information-or-sending-e-mail-on-my-behalf-df007135-c632-4ae4-8577-dd4ba26750a2?CorrelationId=ab7e60d4-de43-48f4-ba9a-7a23786f755f&ui=en-US&rs=en-US&ad=US Yup, saw this one too, but this method is not recommended due to security risk Thus the reason I am trying AutoIT now...
junkew Posted April 27, 2016 Posted April 27, 2016 If you click away automatically the popup you run the same security risk. What is the full userscenario you try to accomplish and how frequently. Most likely you have to move the mousecursor and then send a click. FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets
Juvigy Posted April 27, 2016 Posted April 27, 2016 You can create an Outlook add-in which start the Autoit script and then sign the add - in. That way there will be no security risk and no popup.
televisi Posted April 27, 2016 Author Posted April 27, 2016 The scenario is coming from MYOB application, on which the finance team needs to send payslips to 500+ email recipients; and I noticed they need to have someone manually clicking the "allow" button (it's so yesterday I think...) Interesting enough, I tried to follow the https://support.office.com/en-us/article/I-get-warnings-about-a-program-accessing-e-mail-address-information-or-sending-e-mail-on-my-behalf-df007135-c632-4ae4-8577-dd4ba26750a2?CorrelationId=ab7e60d4-de43-48f4-ba9a-7a23786f755f&ui=en-US&rs=en-US&ad=US by selecting "Never warn me about suspicious activity (not recommended)"; the problem persist. I tried this on office 2007 and 2013 too...very strange... 11 hours ago, Juvigy said: You can create an Outlook add-in which start the Autoit script and then sign the add - in. That way there will be no security risk and no popup. Juvigy, this is interesting method, care to provide an extra insight on this one? Thanks all!
televisi Posted April 28, 2016 Author Posted April 28, 2016 Hi, I finally managed to work-around it by using combination of "Send" keypress. The following is the code that might help anyone in the future expandcollapse popupGlobal $Title = "Outlook Auto Keypress for MYOB v.1.0" #include <MsgBoxConstants.au3> #include <WinAPI.au3> #include <Misc.au3> ;File properties AutoItSetOption("TrayIconDebug", 1) AutoItSetOption("TrayAutoPause", 1) ;Ensure there is only single instance If _Singleton($Title, 1) = 0 Then MsgBox($MB_SYSTEMMODAL, "Warning", "An occurrence of " & $Title & " is already running! Closing this now") Exit EndIf ;infinite loop While True ;Wait 5 sec for the window Local $hWnd = WinWait("Microsoft Office Outlook", "A program is trying to send an e-mail message on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date.") ;Wait 5 sec for the Allow button to be enabled sleep(5000) ;Activate the Window WinActivate($hWnd) If WinActive($hWnd) Then ;ALT+A Send("!a") ;TAB Send("{TAB}") ;Space Send("{SPACE}") EndIf WEnd Now the next question is, how can I rename the posting, to add [SOLVED] in front of the post subject?
Synapsee Posted April 28, 2016 Posted April 28, 2016 4 minutes ago, televisi said: Now the next question is, how can I rename the posting, to add [SOLVED] in front of the post subject? hi, try edit the first post
water Posted April 28, 2016 Posted April 28, 2016 If you can't edit your first post then you haven't reached a needed post count limit. 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
Juvigy Posted April 28, 2016 Posted April 28, 2016 This is to get you started: https://msdn.microsoft.com/en-us/library/cc668191.aspx And this is the certificate part: https://blogs.msdn.microsoft.com/rextang/2009/01/27/self-signed-certificate-and-outlook-vsto-add-in-silent-installation/
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