AutoIt MouseDown Function

The MouseDown function can be used to click and hold a mouse button.

2859 views

Edited: 2021-02-14 02:25

The AutoIt MouseDown function is used to perform a MouseDown event, which can later be released by a MouseUp event.

After sending a MouseDown event, you would typically also want to send a MouseUp event.

If you want to make a selection, or perform a mouse drag and drop operation, then consider using the MouseClickDrag Function instead.

Example showing how to do a mouse-down action, followed by a mouse-up action:

MouseDown("secondary")
Sleep(1000) ; time to hold the button in milliseconds
MouseUp("secondary")

Parameters

This function only takes 1 parameter, being the button to press down.

Values:

left
right
middle
main
menu
primary
secondary

Note that primary is used to refer to the primary mouse button, this is useful since a user might change their key mappings — same logic applies for the secondary value.

Tell us what you think:

  1. How to declare and work with variables in AutoIt, as well as some background information.
  2. Everything you need to know about working with minimized windows.
  3. How to set the request headers when performing HTTP requests.
  4. This Tutorial will focus on post requests in AutoIt, using the Winhttprequest.5.1 object.
  5. How to use while, for, and do until loops, and how to loop through arrays and object in AutoIt.

More in: AutoIt Tutorials