Jump to content

(SOLVED)Fast question about mouseclick/move


Recommended Posts

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
Link to post
Share on other sites

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 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Link to post
Share on other sites
  • Moderators

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

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

"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
Link to post
Share on other sites

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 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

Link to post
Share on other sites

You already did.

If you use

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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2021-06-14 - Version 1.6.5.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
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Tutorials:
ADO - Wiki, WebDriver - Wiki

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...