Jump to content

Win 64 - Cursor Positioning Challenge


Go to solution Solved by PDerryberry,

Recommended Posts

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

Link to comment
Share on other sites

  • Moderators

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

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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...