Sign in to follow this  
Followers 0
PDerryberry

Win 64 - Cursor Positioning Challenge

5 posts in this topic

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

post-86692-0-63088000-1406209559_thumb.p

Share this post


Link to post
Share on other sites



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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Send back the summary tab from the autoit window info tool.

WinActivate->ControlFocus->ControlClick is the way to go

Edited 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.

Share this post


Link to post
Share on other sites

JLogan - Thanks very much - the 'return' did the trick!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0