Need help with DLL(mouse_event)! Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
amirmasoud47
Posts: 11
Joined: 26 Oct 2019, 09:57

Need help with DLL(mouse_event)!

27 Oct 2019, 06:42

Hi this my first time writing scripts and i have tried to write a script that moves the mouse in x,y but i don't know how to control the speed of movement is there any way i can set the value of the movement speed? like adding a line or using some sort of command please help me, by the way if i have any problems in this script i would apprecite any help thank you. :)
Edit: i want to movement speed be Integrated and smooth.

this is what i wrote so far:

#SingleInstance,Force
#NoEnv
SendMode Input
CapsLock::Suspend
Insert::ExitApp
~LButton::
Loop
if GetKeyState("LButton") {
DllCall("mouse_event", int, 1, int, -5, int, 1, int, 0, int, 0)
Sleep 1
}
else
break

return
User avatar
boiler
Posts: 16963
Joined: 21 Dec 2014, 02:44

Re: Need help with DLL(mouse_event)!

27 Oct 2019, 07:21

Why not use the MouseMove command, which has a speed parameter?
amirmasoud47
Posts: 11
Joined: 26 Oct 2019, 09:57

Re: Need help with DLL(mouse_event)!

27 Oct 2019, 10:35

boiler wrote:
27 Oct 2019, 07:21
Why not use the MouseMove command, which has a speed parameter?
@boiler Please read the answer below thanks.
Last edited by amirmasoud47 on 27 Oct 2019, 10:45, edited 1 time in total.
amirmasoud47
Posts: 11
Joined: 26 Oct 2019, 09:57

Re: Need help with DLL(mouse_event)!

27 Oct 2019, 10:41

boiler wrote:
27 Oct 2019, 07:21
Why not use the MouseMove command, which has a speed parameter?
@boiler i don't what to my mouse/cursor go to specific location lets say its like a no recoil but i want to be able to change the speed of movement and even direction of movement. tnx
User avatar
boiler
Posts: 16963
Joined: 21 Dec 2014, 02:44

Re: Need help with DLL(mouse_event)!  Topic is solved

27 Oct 2019, 10:56

It's pretty straightforward. The command can be used to move a relative amount instead of to an absolute coordinate by using the R parameter. The line below moves the mouse pointer +10 in X (to the right), -20 in Y (upward), at a speed of 50 (kind of medium, but experiment with it), relative to its current location. Not knowing exactly what you're trying to accomplish, I suppose I would just replace your DLL call with that line. I suppose by no recoil, the mouse moves a certain amount when you click/shoot, and you want it to move back a certain amount. This allows you to control everything you need to do that by changing the 10, -20, and 100 to whatever you want.

Code: Select all

MouseMove, 10, -20, 50, R
amirmasoud47
Posts: 11
Joined: 26 Oct 2019, 09:57

Re: Need help with DLL(mouse_event)!

27 Oct 2019, 11:54

boiler wrote:
27 Oct 2019, 10:56
It's pretty straightforward. The command can be used to move a relative amount instead of to an absolute coordinate by using the R parameter. The line below moves the mouse pointer +10 in X (to the right), -20 in Y (upward), at a speed of 50 (kind of medium, but experiment with it), relative to its current location. Not knowing exactly what you're trying to accomplish, I suppose I would just replace your DLL call with that line. I suppose by no recoil, the mouse moves a certain amount when you click/shoot, and you want it to move back a certain amount. This allows you to control everything you need to do that by changing the 10, -20, and 100 to whatever you want.

Code: Select all

MouseMove, 10, -20, 50, R
@boiler it works perfectly :superhappy: thank you. +Rep

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], kingina and 207 guests