Jump to content
Sign in to follow this  
EmptySpace

(SOLVED)Fast question about mouseclick/move

Recommended Posts

EmptySpace

I was just experimenting and learning mouse click things and I stucked doing this:

How I should do click few centimetres (y or smth, dont know how to say that) away from current mouse position?

$pos=MouseGetPos()
MouseClick("right",$pos[0],$pos[1],0)
MouseMove($pos[0], and something here?)

I dont need to click exactly in some spot on window. Just some pixels away from mouse pos down. So in y axis. x axis is ok, in same line.

Edited by Edgaras

Share this post


Link to post
Share on other sites
water

Just add the value you want to change the click position to parameter 2 and 3.

MouseClick("right",$pos[0]+10,$pos[1]+10, 0)
My example moves the mouse 10 pixel to the right and 10 pixels down.

Why do you set parameter 4 to 0? This parameter denotes the number of clicks you want to do. To move the mouse fast to the position you have to set parameter 5 to 0.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
JLogan3o13

Though I am tempted to ask what game you're trying to automate, try something like this to get you pointed in the right direction (from a very simple read of the helpfile):

Local $pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1])

MouseMove($pos[0] - 10, $pos[1] - 100, 0)

Local $pos1 = MouseGetPos()
MsgBox(0, "Mouse x,y:", $pos1[0] & "," & $pos1[1])

Edit: Dang beaten again ;)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
EmptySpace

"Though I am tempted to ask what game you're trying to automate" whats wrong with you people? When I ask something all thinks that im making bot! I find fun in autoit and enjoy making things. I have alot of sheets in my pc of examples and other things. With melba help I learned few things with GUI. I wanted to change to something not so difficult and relax from that +100 line codes. So i moved into mouseclick.

Thanks, it works. Didnt even thinked about that.

Edited by Edgaras

Share this post


Link to post
Share on other sites
Autolaser

This WORKS quickly without delay ;)

Example Scripts -> MouseClickFast & MouseMoveFast


Regards Autolaser

Share this post


Link to post
Share on other sites
EmptySpace

Hmm it would be great if I could understand it. But actually I dont need so fast mouse click. In topic name I wanted to say "fast question about mouse click" not for fast clicking.

Share this post


Link to post
Share on other sites
water

It's described in the first post of the thread: "Standard MouseClick & MouseMove functions have got hardcoded Sleep(10)". The new functions eliminate this Sleep so they are a bit faster.

But as speed doesn't matter for you I would stick with the AutoIt standard functions.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
Autolaser

right

example

_MouseClickFast(1180, 470)

move the cursor to the position x1180 y 470 and performs a mouse click ;)


Regards Autolaser

Share this post


Link to post
Share on other sites
EmptySpace

But how I can make something like this?

MouseMove($pos[0] - 10, $pos[1] - 100, 0)

Share this post


Link to post
Share on other sites
water

You already did.

If you use

$pos=MouseGetPos()
to get the current mouse position.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - 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
Sign in to follow this  

×