Jump to content

Mouse click script


Recommended Posts

Hello,

 

I would like to make a mouseclick script.

When i run the .au3 file i want the script to wait for 5 seconds, then click once, wait 1 second, click again.

Then wait 13 seconds and repeat it.

Can someone help me making this script? So far i only got MouseClick ("Left") hehehe....

Thanks, !

 

Kodaah

Link to comment
Share on other sites

So,  

- Run the file.

- Wait 5 seconds, then click once.

- Wait 1 second, then click again.

- Then wait 13 seconds and click.

after that 13 seconds click it can repeating the clicks without the 5 seconds in the beginnen.

Link to comment
Share on other sites

Global $X = @DesktopWidth / 2 ;The X pixel to click. In this example it will click in the middle of your screen if only have one monitor connected.
Global $Y = @DesktopHeight / 2 ;The Y pixel to click.
Global $RandomMin = "1000" ;Should always be an integar in milliseconds.
Global $RandomMax = "13000" ;Should always be an integar in milliseconds.
opt("MouseClickDelay",10);Time in ms between each the Click Up from one click and the Click Down for the next one.
opt("MouseClickDownDelay",10);Time in ms between the Click Down and Click Up for the same click.
opt("MouseClickDragDelay",250);Time in ms between Click Down and the next command in the script.
For $i=1 to 5 ;loops 5 times. Can be a max of 2^32-1 on 32 bit systems or 2^64-1 on 64 bit systems. If you perfer infinite looping, use while 1 wend instead of for next.
    MouseClick("primary",$X,$Y,1,0);Clicks the primary button (usually left) at $x and $y 1 time at 0 speed (instant)
    sleep(Random($RandomMin,$RandomMax)) ;sleeps in ms for a random duration between $RandomMin and $RandomMax.
Next ;Increments $i by one ($i+=1) and repeats the loop. If the loop goes over 5, the loop stops. 

;For additional help, open SciTE and in the menu click Help>Help (Press F1). Note you can click on a function, such as the MouseClick above and then press F1 to get its help file.

 

 

 

Link to comment
Share on other sites

Thank you so much BetaLeaf!

I've placed the X and Y pixel to click, only problem is.. i can't figure out how i get this to an infinit loop.

It works fine for me now, i only want the infinite loop.

 

Global $X = 3200 / 2 ;The X pixel to click. In this example it will click in the middle of your screen if only have one monitor connected.
Global $Y = 1610 / 2 ;The Y pixel to click.
Global $RandomMin = "1500" ;Should always be an integar in milliseconds.
Global $RandomMax = "16000" ;Should always be an integar in milliseconds.
opt("MouseClickDelay",10);Time in ms between each the Click Up from one click and the Click Down for t08he next one.
opt("MouseClickDownDelay",10);Time in ms between the Click Down and Click Up for the same click.
opt("MouseClickDragDelay",250);Time in ms between Click Down and the next command in the script.
Local $i = 0
While $i <= 1 ;loops 5 times. Can be a max of 2^32-1 on 32 bit systems or 2^64-1 on 64 bit systems. If you perfer infinite looping, use while 1 wend instead of for next.
    sleep(Random($RandomMax))
    MouseClick("primary",$X,$Y,1,0);Clicks the primary button (usually left) at $x and $y 1 time at 0 speed (instant)
    sleep(Random($RandomMin)) ;sleeps in ms for a random duration between $RandomMin and $RandomMax.
    MouseClick("primary",$X,$Y,1,0)
    $i = $i + 1
WEnd ;Increments $i by one ($i+=1) and repeats the loop. If the loop goes over 5, the loop stops.

;For additional help, open SciTE and in the menu click Help>Help (Press F1). Note you can click on a function, such as the MouseClick above and then press F1 to get its help file.

 

Here is the script i got right now at the moment,

 

Help me out please <3

Link to comment
Share on other sites

When posting a script please use the code tags in the editor (the button marked "<>"). That enhances readability :)

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

The answer to your question is in the code posted by BetaLeaf.
Out of curiosity: Can you please tell us what you ned the script for?

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

Global $X = @DesktopWidth / 2 ;The X pixel to click. In this example it will click in the middle of your screen if only have one monitor connected.
Global $Y = @DesktopHeight / 2 ;The Y pixel to click.
Global $RandomMin = "1000" ;Should always be an integar in milliseconds.
Global $RandomMax = "13000" ;Should always be an integar in milliseconds.
opt("MouseClickDelay",10);Time in ms between each the Click Up from one click and the Click Down for the next one.
opt("MouseClickDownDelay",10);Time in ms between the Click Down and Click Up for the same click.
opt("MouseClickDragDelay",250);Time in ms between Click Down and the next command in the script.
While 1;loops infinitely
    MouseClick("primary",$X,$Y,1,0);Clicks the primary button (usually left) at $x and $y 1 time at 0 speed (instant)
    sleep(Random($RandomMin,$RandomMax)) ;sleeps in ms for a random duration between $RandomMin and $RandomMax.
Wend

;For additional help, open SciTE and in the menu click Help>Help (Press F1). Note you can click on a function, such as the MouseClick above and then press F1 to get its help file.

 

 

 

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