MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 02:16

Code: Select all

#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.

i:: MouseClickDrag, Left, 5, 470, 510, 470, 100

esc:: ExitApp

I swear it worked perfectly JUST YESTERDAY but when I press 'I' the hotkey, instead of the '80' delay, it instantly clicks and drags. I don't want this to happen. I have been breaking my head on this for so long.. WHY IS THIS HAPPENING. :crazy:
Last edited by Nwb on 30 Mar 2018, 02:26, edited 4 times in total.
I am your average ahk newbie. Just.. a tat more cute. ;)
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 02:20

It works sometimes and doesn't other times. This is confusing.

Just

Code: Select all

i:: MouseClickDrag, Left, 5, 470, 510, 470, 100
works. But it won't work with SendMode input?

But it worked even with SendMode input yesterday. Huh?
I am your average ahk newbie. Just.. a tat more cute. ;)
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 02:49

Well, the docs state clearly:
Speed is ignored for SendInput/Play modes; they move the mouse instantaneously
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 03:00

I have to admit after testing, I don't really understand the behaviour. The speed option seems to work for me, even with SendInput. :shifty:
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 03:21

I tried with SendInput again and it doesn't work. But I could swear that yesterday it worked perfectly fine. This is so weird.
I am your average ahk newbie. Just.. a tat more cute. ;)
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 05:07

I think it has to do with this:
If a script other than the one executing SendInput has a low-level keyboard hook installed, SendInput automatically reverts to SendEvent (or SendPlay if SendMode InputThenPlay is in effect). This is done because the presence of an external hook disables all of SendInput's advantages, making it inferior to both SendPlay and SendEvent. However, since SendInput is unable to detect a low-level hook in programs other than [AutoHotkey v1.0.43+], it will not revert in these cases, making it less reliable than SendPlay/Event.
https://autohotkey.com/docs/commands/Se ... nputDetail

I have loads of other scripts running atm, and I am quite sure that a keyboard hook is active. So, I am not really using SendInput mode - that's why the speed option works for me... if you are running only your script from above and no other script (at least no other that has a keyboard hook), then the speed option will fail (have no effect) like the docs state. I will check later when I can stop my other scripts, but I am fairly certain.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 05:25

gregster wrote:I think it has to do with this:
If a script other than the one executing SendInput has a low-level keyboard hook installed, SendInput automatically reverts to SendEvent (or SendPlay if SendMode InputThenPlay is in effect). This is done because the presence of an external hook disables all of SendInput's advantages, making it inferior to both SendPlay and SendEvent. However, since SendInput is unable to detect a low-level hook in programs other than [AutoHotkey v1.0.43+], it will not revert in these cases, making it less reliable than SendPlay/Event.
https://autohotkey.com/docs/commands/Se ... nputDetail

I have loads of other scripts running atm, and I am quite sure that a keyboard hook is active. So, I am not really using SendInput mode - that's why the speed option works for me... if you are running only your script from above and no other script (at least no other that has a keyboard hook), then the speed option will fail (have no effect) like the docs state. I will check later when I can stop my other scripts, but I am fairly certain.
You're a natural genius. :wtf:
I am your average ahk newbie. Just.. a tat more cute. ;)
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 15:18

@gregster, you can see in the script's keyhistory if it has a hook. Often suspending the script is enough to disable the hook.

Cheers.
gregster
Posts: 8988
Joined: 30 Sep 2013, 06:48

Re: MouseClickDrag suddenly stopped working? (drags instantly instead of delay)

30 Mar 2018, 15:51

Helgef wrote:@gregster, you can see in the script's keyhistory if it has a hook. Often suspending the script is enough to disable the hook.

Cheers.
Yes, that's right. Thank you, helgef! I really had an active hook in another script, when the speed option "worked" for me...

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: haomingchen1998, TAC109 and 241 guests