Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

Set the Mouse Speed/Sensitivity


  • Please log in to reply
9 replies to this topic
  • Guests
  • Last active:
  • Joined: --
Hello,

I want to write a script that sets my mouse speed under windows low while holding down a key on my keyboard. That is for precise positioning in a program (so the normal speed is for usual work and the lowered speed to pixel-accurate mouse cursor positioning).

I know how to check if a key is pressed, but is it possible to set the mouse speed (not only for the MouseMove but the overall windows mouse sensitivity) ?

Thanks a lot for your help

NoNicknameAlert
  • Guests
  • Last active:
  • Joined: --
:roll:

slope
  • Members
  • 3 posts
  • Last active: Oct 01 2005 03:44 PM
  • Joined: 30 Sep 2005
NoNicknameAlert? :) Isn't it allowed to post without registering? Sorry for that, so I registered a nickname.

Anyway, does anyone have an idea regarding my question?

NoNicknameAlert
  • Guests
  • Last active:
  • Joined: --
You can choose and use a nick without being registered. Look at mine :wink:.

Anyway, thx for your understanding. That will it make easier for you, me & all the folks out there to identify and support you. Good luck and have fun :D

NoNicknameAlertAlert
  • Guests
  • Last active:
  • Joined: --
See above.

I would like to suggest that you create an account that has a "special" name and then post your tips using that account. At least we'd know that your (somewhat) for real, and I will know what your posts are about and just skip reading them.

I suggest... ForumTipper

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

I want to write a script that sets my mouse speed under windows low while holding down a key on my keyboard.

The following seems to work. You would hold down your F1 key while moving the mouse cursor to make the cursor very slow:
; The first parameter is always 0x71 (SPI_SETMOUSESPEED).
; The third parameter is the speed (range is 1-20, 10 is default).

F1::
DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, 3, UInt, 0)
KeyWait F1  ; This prevents keyboard auto-repeat from doing the DllCall repeatedly.
return

F1 up::DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, 10, UInt, 0)


NoNicknameAlert
  • Guests
  • Last active:
  • Joined: --
Alert wrote:

and I will know what your posts are about and just skip reading them

If you see my nick next to a posting (at the forum index) you can act that way, as the content is all about to choose a nick. Nothing else. Happy scripting everybody & have fun. :)

slope
  • Members
  • 3 posts
  • Last active: Oct 01 2005 03:44 PM
  • Joined: 30 Sep 2005

The following seems to work. You would hold down your F1 key while moving the mouse cursor to make the cursor very slow:
....


Thanks a lot, I will test it tonight. I didn't know that there's a "F1 up::",so my script recognizes when I release the F1 key (I'm very new to AHK)... I found this sample in the AHK help file to simulate a "hold mouse button down" with a key:

*F1::
MouseClick, middle,,, 1, 0, D
Loop
{
	Sleep, 10
	GetKeyState, state, F1, P
	if state = U
		break
}
MouseClick, middle,,, 1, 0, U
return

Now where I know there is a "F1 up::", has the following code the same functionality? :

*F1::
MouseClick, middle,,, 1, 0, D
KeyWait F1
return

*F1 up::
MouseClick, middle,,, 1, 0, U
return

Sorry for beeing off-topic, but is there a difference between those two scripts? :)

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

is there a difference between those two scripts? :)

I think they're functionally identical, so whichever you want to use should be fine (though key-up hotkeys might require that you upgrade your AutoHotkey if it's old). Scripts that use key-up hotkeys are probably a little more efficient than ones that use KeyWait to achieve the same thing.

slope
  • Members
  • 3 posts
  • Last active: Oct 01 2005 03:44 PM
  • Joined: 30 Sep 2005
Ok, thanks for the info.... and btw: I just tried your mouse speed solution, and it works perfectly for me :) Thanks a lot.