Hi,
Could you please help me with where to read to be able to do a code (or the codes itself... ) so it will send a double click when I hold down LButton say pass 500ms?
Thank you very much
Double click when hold down LButton long enough?
Double click when hold down LButton long enough?
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
Re: Double click when hold down LButton long enough?
You need to be more specific on how you want it to work. Do you want the first click to occur immediately upon clicking down then send another click if it’s held down for at least 500 ms? Or do you want it to wait until you release the mouse button before sending anything, then click once if held for less than 500 ms or twice in rapid succession if held for 500 ms or more? If the latter, then normal clicks won’t happen until you release the mouse button instead right when you click down (the normal way).
Re: Double click when hold down LButton long enough?
Wow thank you Boiler! I didn't think that far... Yes, if held down less than 500ms then a single click is sent when release, and if held down more than 500ms then a (very quick) double click is sent when release - to do a usual "double clicking". Thank you Boiler!
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
Re: Double click when hold down LButton long enough?
Try this:
Note that this precludes the ability to drag things with the mouse. That could probably be added if necessary.
Code: Select all
#Requires AutoHotkey v2.0
LButton:: {
start := A_TickCount
KeyWait 'LButton'
if (A_TickCount - start) > 500
Click
Click
}
Note that this precludes the ability to drag things with the mouse. That could probably be added if necessary.
Re: Double click when hold down LButton long enough?
Oh... You are right Boiler...! We still need to exclude the case when the mouse was hold long BUT moved a decent distance (8 (?)) ...? Thank you Boiler...!!
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
Re: Double click when hold down LButton long enough?
This allows you to drag if it is moved more than 8 pixels. However, you can't see it dragging in real time because it has to wait until the mouse is released before it can tell if it was meant to be a drag or a double-click. So it will perform the drag (such as a window moving) without you seeing it happen until you release the mouse button. You can't expect to fundamentally change the way the mouse clicks work and then still have everything behave as if you didn't change it.
Code: Select all
#Requires AutoHotkey v2.0
LButton:: {
MouseGetPos &px, &py
start := A_TickCount
KeyWait 'LButton'
MouseGetPos &cx, &cy
if ((A_TickCount - start) > 500)
if (Abs(cx - px) > 8) || (Abs(cy - py) > 8)
MouseClickDrag 'L', px, py, cx, cy, 0
else
Click 2
else
Click
}
Re: Double click when hold down LButton long enough?
Thank you very much Boiler!! I didn't know it's that complicated! But, it gives me this attached error when run thanks again Boiler?
- Attachments
-
- 2024-05-06_14h40_31.png (44.69 KiB) Viewed 257 times
*** Thank you for reading. I am not in coding and know almost nothing about professional coding, hope for your patience and deeply appreciate any of your kind helps. My current interest in this awesome AHK is due to that my work is graphical ((architect/CAD) and, to reduce strains, my right hand is better off not leaving the mouse (an MMO mouse that has 12 side keys which I maps a lot of F keys and other keys in) as much as possible. All the best you lovely coders! ***
Re: Double click when hold down LButton long enough?
If you run a different script, I can’t help troubleshoot it. The script I posted has only 15 lines, not over 150 lines.