Sign in to follow this  
Followers 0
Lightor

Move mouse while clicking

6 posts in this topic

Hey guys, I've been able to research most things I've been trying to do but this one has stumped me.

I have 2 mouse captures, then I want to move from one to the other while clicking and I can't seem to get it.  I can move then click but thats about it.  Right now this is where I'm at.

MouseMove($mousePos1[0], $mousePos1[1], 0)
MouseMove($mousePos2[0], $mousePos2[1], 75)

$tempMousePos = MouseGetPos()
While Not ($tempMousePos[0] == $mousePos2[0] and $tempMousePos[1] == $mousePos2[1])
   MouseClick("Left")
   Sleep(250)

   $tempMousePos = MouseGetPos()
WEnd

Share this post


Link to post
Share on other sites



have you looked at any of the other mouse functions?

like mouseclickdrag, or mousedown and mouseup?

:alien:


if @error Then
	MsgBox(262192,"",@ComputerName&" slaps "&@UserName&" around a bit with a large trout!")
	EndIf

>Exit code: 0

REAL search results

"Yeah yeah yeah, patience. How long will that take?"  -Ed Gruberman

Share this post


Link to post
Share on other sites

Welcome to AutoIt and the forum!

Can you please tell us which program you try to automate?

We then can provide a solution (hiopefully) that suits your needs.


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

#4 ·  Posted (edited)

I was trying to automate clicks in a game, clicking possible fishing spots while moving along the water.  I ended up using this, not sure if its the most efficient way but it works.  Although if there's a better way I'd be very interested in learning it.

While $endLoop == False

   ControlSend($hwnd, "", "", "r")
   MouseMove($mousePos1[0], $mousePos1[1], 0)
   Sleep(100)
   MouseClick("Left")
    Sleep(250)

   For $p = 0.1 To 1 Step + 0.05

      $xDif = Abs($mousePos1[0] - $mousePos2[0])
      $yDif = Abs($mousePos1[1] - $mousePos2[1])

      If $mousePos1[0] > $mousePos2[0] Then
         $xDif = $xDif * -1
      EndIf

      If $mousePos1[1] > $mousePos2[1] Then
         $yDif = $yDif * -1
      EndIf

      MouseMove($mousePos1[0] + $xDif * $p, $mousePos1[1] + $yDif * $p, 25)
      Sleep(10)
      MouseClick("Left")
      Sleep(250)

      Next

      Call("sleeper", 8)
WEnd
Edited by Lightor

Share this post


Link to post
Share on other sites

Seems you missed to read the forum rules on your way in.

The rules do not allow game automation of any kind.

A link to the rules can be found in the lower right corner of each page.

So that's why you will not get any help on the subject.

Hope to see you with a legitimate question soon :)


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

Got me there, I didn't read them, my mistake.  :oops:  I understand the moral stance on game automation and can understand why, thanks for the heads up and quick response though.  :D

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0