Hello, I am trying to create a record mouse location script.
I'd like this script to have a simple gui so that I know when it is toggled on or off.
1. Pressing F5 will toggle on the script and record the mouse cursor position. This toggle will also change how my mouse works. Every left click will now jump my mouse to the recorded mouse cursor position and right click on that spot. Once the right click has been sent, then the mouse cursor should jump back to the middle of the screen.
Pressing F5 again will toggle off this script so that my mouse behaves normally.
I know this is a long shot, but if something like this is possible or anything close to it, I'd greatly appreciate it. Thank you kindly~
Record mouse position script Topic is solved
Re: Record mouse position script Topic is solved
Code: Select all
#Requires AutoHotkey v2.0
gui1 := Gui('+AlwaysOnTop', 'Recording'), gui1.SetFont('s14')
txt := gui1.AddText('w200 Center')
gui1.Show('x1500 y50'), guiToggle(on := False)
cx := A_ScreenWidth / 2, cy := A_ScreenHeight / 2
F5:: {
Global on, x, y
CoordMode 'Mouse'
guiToggle(on := !on), MouseGetPos(&x, &y)
}
#HotIf on
LButton:: {
CoordMode 'Mouse'
MouseClick('R', x, y), MouseMove(cx, cy)
SoundBeep 900
}
#HotIf
guiToggle(trueFalse) {
If trueFalse
gui1.BackColor := 'FFFF9E', txt.Value := 'ON' , SoundBeep(1500)
Else gui1.BackColor := 'FF8E8E', txt.Value := 'OFF', SoundBeep(1000)
}
Re: Record mouse position script
@mikeyww
Thank you mikey. You're a genius. I can't believe this works.
Thank you mikey. You're a genius. I can't believe this works.
Re: Record mouse position script
@mikeyww
Can you help me with a slightly different version of this?
Instead of a toggle, can I have pressing 'y' show a little box next to my cursor that says "left click" and when I left click it records the mouse position?
And only when I press control+v, the mouse will jump to the recorded mouse position and immediately right click and then jump the mouse cursor back to the middle. Or if possible, have the mouse jump back to the most recent left click right after the right click.
The toggle gui is not needed for this but the small text box that primes the left click for the record mouse position next to the cursor would be fantastic. I would greatly appreciate your help once more. Thank you for making me realize how powerful AHK can be.
Can you help me with a slightly different version of this?
Instead of a toggle, can I have pressing 'y' show a little box next to my cursor that says "left click" and when I left click it records the mouse position?
And only when I press control+v, the mouse will jump to the recorded mouse position and immediately right click and then jump the mouse cursor back to the middle. Or if possible, have the mouse jump back to the most recent left click right after the right click.
The toggle gui is not needed for this but the small text box that primes the left click for the record mouse position next to the cursor would be fantastic. I would greatly appreciate your help once more. Thank you for making me realize how powerful AHK can be.
Re: Record mouse position script
I'm going to leave these changes to you, as my time is going to be very limited in the coming week. Good luck! Perhaps it is a good way to learn some AutoHotkey.
Re: Record mouse position script
@mikeyww
I understand thank you! I will give it a shot!
I understand thank you! I will give it a shot!