Hi
I am a total noob when it comes to AHK. So i need help with what want i to make.
The thing i want to make are scripts that will do the following commands:
- return/leave mousepointer at where it started when the hotkey activitating the script is pressed
- Press a certain key (which has a function in the game i will use it for)
- move the mousepointer to several specific locations in fast succession and do a left click on each location while moving
- be able to loop the 2 above commands, meaning: Key --> mousemovement+clicking --> key --> mousemovement+clicking
is this possible and if so, how is it done?
need help for combining mousemovement, clicking and keys
Re: need help for combining mousemovement, clicking and keys
Hi and welcome,
Yes, such things are possible.
I recommend you to take a loot at the documentary.
https://autohotkey.com/docs/commands/MouseClick.htm
Basically you need commands like:
MouseGetPos, xx, yy ; Checks out the current mouse position
Send {key} ; presses a key (virtually)
MouseMove xx, yy, 0 ; Moves the mouse cursor to the original mouse position
Sleep, 50 ; Delay in milliseconds (optional - you might use or not use them - as you wish)
Example code to perform the following:
- Checking mouse pos
- moving mouse to one point
- pressing left button
- returning to normal point:
- script gets activated by F1 (change it to any key)
To find out the mouse position (where you want to move your cursor),
you can use this code:
When you press F2, AHK automatically gets the mouse position and stores it to the Clipboard.
(Otherwise you would have to know the exact x, y position, which is kind of impossible - execpt for positions like 0, 0)
After this, just go to your script and press Ctrl+V to paste it.
Master these basics first before you start looping
Regards
Yes, such things are possible.
I recommend you to take a loot at the documentary.
https://autohotkey.com/docs/commands/MouseClick.htm
Basically you need commands like:
MouseGetPos, xx, yy ; Checks out the current mouse position
Send {key} ; presses a key (virtually)
MouseMove xx, yy, 0 ; Moves the mouse cursor to the original mouse position
Sleep, 50 ; Delay in milliseconds (optional - you might use or not use them - as you wish)
Example code to perform the following:
- Checking mouse pos
- moving mouse to one point
- pressing left button
- returning to normal point:
- script gets activated by F1 (change it to any key)
Code: Select all
F1::
MouseGetPos, xx, yy
Sleep, 5
MouseMove 500, 500, 0
Sleep, 5
Send {lbutton}
Sleep, 5
MouseMove xx, yy, 0
return
you can use this code:
Code: Select all
F2::
MouseGetPos, xx, yy
Sleep, 5
Clipboard = MouseMove %xx%, %yy%, 0
return
(Otherwise you would have to know the exact x, y position, which is kind of impossible - execpt for positions like 0, 0)
After this, just go to your script and press Ctrl+V to paste it.
Master these basics first before you start looping
Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
Who is online
Users browsing this forum: Google [Bot] and 150 guests