loganvh22

hold a button down for a certain part of my script

4 posts in this topic

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

Share this post


Link to post
Share on other sites



i am going to bed now i wil reply tomorrow

Share this post


Link to post
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")

1 person likes this

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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