I have the following AHK script (obtained from https://medium.com/@dakshin.k1/enable-3-finger-gesture-for-click-and-drag-on-windows-and-linux-cd7165b66851 ):
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance force
; Enable three-finger drag
drag_enabled := 0
+^#F22::
if (drag_enabled) {
Click up
drag_enabled := 0
} else {
drag_enabled := 1
Click down
}
return
LButton::
if (drag_enabled) {
Click up
drag_enabled := 0
} else {
click
}
return
This is supposed to enable Mac-style three-finger dragging on any Windows 10 laptop's touchpad, but with the following three steps required:
I am absolutely gobsmacked that AHK is capable of all of this, so it doesn't come as a surprise that it doesn't quite work as well as I'd hoped. After an indeterminable amount of time, I can no longer click/tap with my touchpad normally .
+^#F22
actually do ? The docs and my limited knowledge of AHK seem to imply that it would set up Shift+Ctrl+Win+Whatever F22 means
as a hotkey that enables step 1. above. But does it also enable step 2? If not...I have spent about 2 hours on this already, reading the docs and trying to refamiliarise myself with AHK in general, because it's been an age since I last used it (and even then, I never did anything half as advanced as this)!
+^#F22
does what you said, it registers a hotkey for Shift + Ctrl + Win + F22 (yes, F keys 13-24 exist).
So on your installation, performing a three-finger-tap should send that key combination to Windows.
You can try that with eg SendInput, +^#{F22}
That should open up the Windows search/Cortana.
On my laptop a three-finger-tap sent just a simple Win + s to Windows.
But I guess on your installation it's different (for whatever reason).
You can find out what exactly gets sent by using eg Keyhistory
(docs) .
So anyway, how does the script work? It's actually really really simple and clearly made by an AHK novice.
When a three-finger-tap is intercepted (via the +^#F22
hotkey), the scripts check if the user defined toggle drag_enabled
evaluates to true or false.
The LButton
hotkey is there so the dragging can also be ended by clicking LButton.
The hotkey is actually badly implemented though, and it breaks the native functionality of LButton. I'll fix that below.
How is AHK able to track the mouse pointer, keeping the drag action going while any amount of finger removals from, and re-contacts with, the touchpad are possible?
AHK doesn't care about any of that. It's all handled by Windows. Doing which ever mouse movements (except clicking) don't matter for the dragging action. Only clicking would cancel LButton being held down.
How can I fix the touchpad clicking problem (I have a feeling that the answer is "you can't", but please prove me wrong)?
I don't really know what you mean, but I could guess/hope it's just caused by the badly implemented LButton
hotkey. I guess try and see if my improved version below fixes it.
So the improved version:
+^#F22::
if (drag_enabled)
Click, Up
else
Click, Down
drag_enabled := !drag_enabled
return
#If, drag_enabled
LButton::
Click, Up
drag_enabled := false
return
#If
Changes are basically just compacting/removing useless code and properly implementing the LButton
hotkey to not break the native functionality of LButton when dragging is not in progress.
Seems to work just fine on my laptop, except I replace +^#F22
with #s
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.