Jump to content
Sign in to follow this  
Azevedo

ControlClick() doesn't always work

Recommended Posts

Azevedo

Hi,

I'm using ControlClick() to click on Firefox window according to the window title.

It works at first but after a couple loops it won't find the window by title anymore. The window title change on page reload but it will be back to original title.

Opt("WinTitleMatchMode", 2)
Opt("MouseCoordMode", 0)

$main_title = "my page title"
$ymouse = 100


Do
   ; click refresh
   ControlClick($main_title, "", 0, "left", 1 , 428 , $ymouse )
   Sleep(5000)

   ; click print
   ControlClick($main_title, "", 0, "left", 1 , 1244 , $ymouse )

   sleep(60000)
Until (0)

Share this post


Link to post
Share on other sites
jdelaney

use the ff.au3, but for a quick fix, do this...handles don't change, title may:

$main_title = "my page title"
$hwnd = WinGetHandle($main_title)
$ymouse = 100


Do
   ; click refresh
   ControlClick($hwnd, "", 0, "left", 1 , 428 , $ymouse )
   Sleep(5000)

   ; click print
   ControlClick($hwnd, "", 0, "left", 1 , 1244 , $ymouse )

   sleep(60000)
Until (0)

this assumes a few things:

1) your window is already open at beginning of the script

2) you always want to perform the click on the same window (found in number 1)

If you open/close windows, this will not work.

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

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  

×