Control mod not recognized with long press of left mouse

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
klownboy
Posts: 8
Joined: 03 Apr 2024, 10:27

Control mod not recognized with long press of left mouse

Post by klownboy » 21 Apr 2024, 12:20

Any ideas on why the following is not working with the control mod key held down. The normal left mouse long press is working (i.e., I'm getting a sound beep and the script works properly with XYplorer - SendInput {NumPad4) works. However, it's not working with control held down, not even a sound beep. Thank you.

Code: Select all

#If (MouseIsOver("ThunderRT6PictureBoxDC56") OR MouseIsOver("ThunderRT6PictureBoxDC57"))

~LButton::                                     ; Long press (> 1. sec) on * substitutes the dot multiply
ctrlState := GetKeyState("Control", "P") ? 1 : 0

KeyWait, LButton, T0.4                         ; Wait no more than .4 sec for key release (also suppress auto-repeat)
If ErrorLevel   {                              ; timeout, so long press
Send {Click Left}

If ctrlState {            ;if GetKeyState("Control", "P") {
soundbeep
Sendinput {BLIND}^{Numpad4}                ;Run, D:\Tools\XYplorer\XYplorer.exe /script=::#1445

} Else
soundbeep
SendInput {Numpad4}
KeyWait, LButton
} Else                                                ; otherwise...
Send {Click Left}                                       ; ...just send
Return

MouseIsOver(controlName) {
    MouseGetPos, , , , controlNameUnderMouse
    return (controlName = controlNameUnderMouse) ? 1 : 0
}
User avatar
boiler
Posts: 17154
Joined: 21 Dec 2014, 02:44

Re: Control mod not recognized with long press of left mouse

Post by boiler » 21 Apr 2024, 12:26

Your hotkey is not for Ctrl+Click. It just for Click, so it won’t fire if Ctrl is held down. If you want the hotkey to fire with Ctrl, either add it:

Code: Select all

~^LButton::
~LButton::
…or use the wildcard modifier:

Code: Select all

~*LButton::
klownboy
Posts: 8
Joined: 03 Apr 2024, 10:27

Re: Control mod not recognized with long press of left mouse

Post by klownboy » 21 Apr 2024, 12:45

Last night before bed I was wondering if a second hotkey was necessary, and I forgot about that morning. I guess it was. It's all working now. By the way I was on this forum and made a number of posts (mostly in the ClipJump thread) over 10 years ago, but when I recently went to get back, they didn't have any record of my logon. No worries, same logon name. Thanks again for your help on this and also on my previous post.
User avatar
boiler
Posts: 17154
Joined: 21 Dec 2014, 02:44

Re: Control mod not recognized with long press of left mouse

Post by boiler » 21 Apr 2024, 13:47

klownboy wrote: By the way I was on this forum and made a number of posts (mostly in the ClipJump thread) over 10 years ago, but when I recently went to get back, they didn't have any record of my logon. No worries, same logon name.
That was on the old forum. There is a bunch of history as to why, but this one started with a different domain before eventually it was all brought under autohotkey.com again. Those you see here that have the same username as back then (including myself) had to create another account here, so you have now just done the same.
Post Reply

Return to “Ask for Help (v1)”