Help with Keywait for Control Mouse Move

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
arbibarbarona
Posts: 63
Joined: 05 May 2021, 10:19

Help with Keywait for Control Mouse Move

Post by arbibarbarona » 03 Dec 2022, 13:20

Code: Select all

Left::
Right::
If !go
SendEvent, {LButton down}
go := True
MouseMove, A_ThisHotkey = "Left" ? -2:2, 0,, R
SetTimer, Stop380, -400
Return
Stop380:
SendEvent, {LButton up}
go := False
Return
Hello guys.

I'm here again and I need some help setting up a Keywait function.
The Upper script works perfectly. But I want to add a similar function that If I press Down Control, It Sends the LButton down then using \, and Insert will move the mouse 12 pixel to left or right, then if I lift the Control up it lifts the LButton up.

Thank you in advance.

Code: Select all

^Left::
^Right::
SendEvent, {LButton down}
Keywait, ^
{
MouseMove, A_ThisHotkey = "^Left" ? -12:12, 0,, R
}
SendEvent, {LButton up}

Return

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

Re: Help with Keywait for Control Mouse Move

Post by boiler » 03 Dec 2022, 13:29

^ is not the key name for Ctrl to be used with KeyWait. It's only Ctrl as a modifier to other keys. Use Ctrl.

arbibarbarona
Posts: 63
Joined: 05 May 2021, 10:19

Re: Help with Keywait for Control Mouse Move

Post by arbibarbarona » 03 Dec 2022, 14:29

Code: Select all


^\::
^Insert::
SendEvent, {LButton down}

{
MouseMove, A_ThisHotkey = "^\" ? -12:12, 0,, R

Keywait, Control
}
SendEvent, {LButton up}

Return
THis seems to just function once. But what If I want to continuesly move the mouse while Left button is Down. Either left or right. and If I lift control up it release the action

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

Re: Help with Keywait for Control Mouse Move

Post by boiler » 03 Dec 2022, 14:41

Instead of KeyWait, use a While loop with GetKeyState().

Post Reply

Return to “Ask for Help (v1)”