By using this site you agree to the use of cookies by Brugbart and our partners.

Learn more

Send Mouse Clicks to Minimized Windows With AutoIt

Sending mouse clicks without moving the mouse, and clicking in minimized windows.

Edited: 2015-02-13 00:35

This AutoIt Tutorial shows how to click in a minimized window, without moving the mouse – or how you can send mouse clicks to minimized windows. Sending mouse clicks without involving the mouse can be done with the ControlClick function.

There can be many reasons why you want to send mouse clicks without moving the mouse, but by far the number 1 reason, is to allow normal use of your computer while a AutoIt program or script is running. Knowing the exact coordinates to click can however be difficult, so in a lot of cases it may appear like it doesn't work, when just you got the wrong coordinates.

Clicking in Minimized Browser Windows

If you want to automate your Internet browser, it can often be easier to send the http requests directly, from within AutoIt – this ensures that your program will work on other systems, regardless of browser, toolbars, and other things that might effect the UI of the browser.

See also: AutoIt HTTP Request Tutorial

Having said that, you can also simply instruct users to disable any browser toolbars, and other UI effecting extensions. Perhaps the easiest, and most user-friendly solution, is to locate the "edges" of the browser viewpoint, this can be done using a combination of PixelSearch, and a static html page with a "unique" background color – but it's rather clumsy compared to going the route of http requests – the static page would be used by a setup script, which would then determine the UI layout in the users browser.

Sending mouse clicks to minimized windows

If you still want to know how you can send mouse clicks to a minimized browser window, the below script will attempt to click inside a minimized browser window, about 135 pixels from the top, and 10px from the left – you may need to adjust this to work with your own UI layout.

$handle = WinGetHandle("MyButton - Mozilla Firefox", "")

This has been tested with a HTML file in Firefox, the file can be located at:

The parameters used in the function are mainly the last three – the first of these is the number of times to click, the second and third are the coordinates – you should look up the reference to learn more on ControlClick.