Jump to content

hold a button down for a certain part of my script


Recommended Posts

I am really new i just started a few hours ago and I am making a script to hold mouse 1 for most of the script.... i made the script

Sleep(1000)

Send("{d down}")

Sleep(16000)

Send("{d up}")

Sleep(1000)

Send("{w down}")

Sleep(800)

Send("{w up}")

Sleep(1000)

Send("{a down}")

Sleep(16000)

Send("{a up}")

Sleep(1000)

Send("{w down}")

Sleep(800)

Send("{w up}")

Sleep(1000)

       how will i hold "left" at the same time it is running all of this? and i also have this later in my script for a standing still right click but idk how to have a right click going for the code above 

#include <AutoItConstants.au3>

MouseDown($MOUSE_CLICK_RIGHT) ; Set the left mouse button state as down.

Sleep(20000)

MouseUp($MOUSE_CLICK_RIGHT) ; Set the left mouse button state as up.

any help would be appreciated thank you :0

Link to comment
Share on other sites

Just use MouseDown before your Send code and then end with MouseUp, add the difference in your sleep at the end

Example 

MouseDown("right")

Send()...
sleep()..

sleep(20msec - sleep time passed )

MouseUp("right")

Link to comment
Share on other sites

Welcome to Autoit and the forum!
Could you please tell us which program you try to automate? Such mouse operations are not very reliable as they depend on screen resolution and window position.
Most of the time there are more reliable functions available.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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