Jump to content

Position of Mouse


Recommended Posts

Is it possible to record the position of the mouse when a hot key is pressed then have autoit move the mouse and then return the mouse to the original position? If so how?

It's very much possible, and while I am as irked about this kind of question as the first person to reply, I'll at least give you the structure on how to do it and then let you go run off to the functions list to figure out what to use.

[define a hotkey to execute a function]

[here's the function]

$var = my current mouse position

move my mouse to a new position

move my mouse to $var

[end of my function]

Link to comment
Share on other sites

Hotkeyset("{f9}", "Record")
HotKeySet("{HOME}", "Play")
Global $count=0 ,$records[15][2];max number of records

While 1
$pos = MouseGetPos()
ToolTip("("&$pos[0]&", "&$pos[1]&")",0,0)
If $Count >= 14 then $count=0
Wend

Func Record()
$Pos = MouseGetPos()
$records[$count][0] = $pos[0]
$Records[$count][1] = $pos[1]
Tooltip("Recorded:  ("&$records[$count][0]&", "&$Records[$count][1]&")",0,0)
$count+=1
EndFunc

Func Play()
For $i = 0 to $count
MouseClick("Left", $records[$i][0], $Records[$i][1])
Sleep(100)
Next
EndFunc

Record a series of positions, then have autoit click them all.

Edited by Paulie
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...