PDerryberry Posted July 24, 2014 Share Posted July 24, 2014 Here's my challenge now. This script basically does a 'batch print' on a series of reports. My challenge is that the 'printer window' (standard windows 7 printer screen) shows up in a slightly different position on different monitors, depending on the monitor size. One of the 'clicks' is to click OKAY on the 'printer window'. Any ideas how to determine the location of the OKAY button? #AutoIt3Wrapper_UseX64=n #include <Constants.au3> ; AutoIt Version: 3.0 ; Language: English ; Platform: Win9x/NT ; Author: ; Script Function:Print MS Management Reporter Reports Run("C:\Program Files\Microsoft Dynamics ERP\Management Reporter\2.1\Client\ReportViewer.exe") WinWaitActive("[CLASS:WindowsForms10.Window.8.app.0.30495d1_r11_ad1]") AutoItSetOption("SendKeyDelay", 1500) AutoItSetOption("MouseClickDelay",0) Send("{TAB}") Send("{TAB}") Send("{TAB}") Send("{TAB}") Local $Iterations = 1 local $CursorPosition = 158 Do $Iterations = $Iterations + 1 $CursorPosition = $CursorPosition + 22.5 Mousemove(260,$CursorPosition) sleep(1000) Mouseclick ("left",260, $CursorPosition, 2) AutoItSetOption("MouseClickDelay",2000) Mouseclick ("left",810, 207, 1) Mouseclick ("left",636, 65, 1) Mouseclick ("left",779,525,1) ;<<<The Click In Question Mouseclick ("left",1264, 117, 1) AutoItSetOption("MouseClickDelay",0) Until $Iterations > 15 MsgBox($MB_SYSTEMMODAL, "Script", "Reports Are Spooled") exit Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted July 24, 2014 Moderators Share Posted July 24, 2014 Have you tried just sending an Enter? Send("{Enter}") I would also suggest looking into the AutoIt Window Info Tool (located in the same directory where you installed AutoIt, or CTRL + F6 in SciTE). I can't recall what info, if any, you can get from the print window, but you may be able to get the control ID of the OK button and then do a ControlSend or ControlClick. "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...
PDerryberry Posted July 24, 2014 Author Share Posted July 24, 2014 Already tried the Window info tool but the button does not have a 'useable' control name. I could not find anything to 'trap', so that is why I used corordinates and Mouseclick. I will try the 'Send Enter' to see if that works. Link to comment Share on other sites More sharing options...
jdelaney Posted July 24, 2014 Share Posted July 24, 2014 (edited) Send back the summary tab from the autoit window info tool. WinActivate->ControlFocus->ControlClick is the way to go Edited July 24, 2014 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Solution PDerryberry Posted July 29, 2014 Author Solution Share Posted July 29, 2014 JLogan - Thanks very much - the 'return' did the trick! 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