Hotkey doesn't work

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Hotkey doesn't work

Post by hemsith14_ » 30 Jun 2022, 21:18

Hey, why is the following hotkey doesn't work for me? I'm trying to simulate a middle button click with left button in chrome so I can scroll pages without using the wheel.

Code: Select all

^!LButton::
Send, {MButton down}
KeyWait, LButton
Send, {MButton up}
Return
Any ideas? I thought it should be a simple one. Thanks!

User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Hotkey doesn't work

Post by mikeyww » 30 Jun 2022, 22:26

Code: Select all

^!LButton Up::
KeyWait, Ctrl
KeyWait, Alt
Click, M
Return

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 30 Jun 2022, 22:36

It's not working the way I wanted it to

I want to hold LButton and simulate this as a hold of MButton so I can drag the page.

User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Hotkey doesn't work

Post by mikeyww » 30 Jun 2022, 22:58

It worked in my test after I installed the Chrome extension for MButton.

You have written it as Ctrl+Alt+LButton. You can also try:

Code: Select all

LButton::MButton
or alter the earlier script to remove the modifiers.

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 30 Jun 2022, 23:25

Maybe I wasn't clear enough,

What I want is to drag the page like when the middle button of the mouse is pressed, but do it with the following shortcut: ctrl + alt + LButton.

So, when I press the LButton I can hold it and drag through the page.

User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Hotkey doesn't work

Post by mikeyww » 01 Jul 2022, 06:14

Your description is not clear, but my script worked, so I cannot add anything further. Others may have some additional ideas for you.

RussF
Posts: 1269
Joined: 05 Aug 2021, 06:36

Re: Hotkey doesn't work

Post by RussF » 01 Jul 2022, 06:24

@hemsith14_, while following this thread, I too was confused.
hemsith14_ wrote: I'm trying to simulate a middle button click with left button in chrome
hemsith14_ wrote: I want to hold LButton and simulate this as a hold of MButton so I can drag the page.
hemsith14_ wrote: What I want is to drag the page like when the middle button of the mouse is pressed, but do it with the following shortcut: ctrl + alt + LButton.
hemsith14_ wrote: So, when I press the LButton I can hold it and drag through the page.
You've stated three times that you want to simulate MButton by pressing LButton, but then throw in that you want to do it using Ctrl-Alt-LButton. Which is it that you want - LButton alone or Ctrl-Alt-LButton?

Russ

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 01 Jul 2022, 09:45

Press ctrl + alt + lbutton

Hold LButton

While LButton is being held, keep MButton held

That way, you can move through the window while using this shortcut and holding LButton, when LButton is released, stop until I press it again with the combination.

RussF
Posts: 1269
Joined: 05 Aug 2021, 06:36

Re: Hotkey doesn't work

Post by RussF » 01 Jul 2022, 10:09

Ok, so...

Press Ctrl-Alt-LButton to activate MButton

Release Ctrl and Alt, but as long as LButton remains physically held down, continue to logically hold MButton down.

Upon physical release of LButton release MButton. Correct?

I played around with it for a while, but didn't have time to solve it. Unfortunately, I have to leave my workstation for a few hours, but hopefully someone with more experience can help in the meantime now that there is a clearer description of what you need.

Russ

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 01 Jul 2022, 10:20

Yes, thanks Russ!

User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Hotkey doesn't work

Post by mikeyww » 01 Jul 2022, 11:42

Your first script does that. Does it work when you use MButton manually? I had to install a Chrome extension to get scrolling here.

Nonetheless, I then had to use my script, which sent the button both down and up-- after release of modifiers-- because that was how the extension worked.

See :arrow: KeyHistory to understand what is happening with the keys.

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 01 Jul 2022, 14:20

I was attempting to do that with my first script but it didn't work for some reason, it seems like it's pressing the MButton but then quickly releasing it.

It does work however, when I change the key wait to something like "W".

User avatar
mikeyww
Posts: 26944
Joined: 09 Sep 2014, 18:38

Re: Hotkey doesn't work

Post by mikeyww » 01 Jul 2022, 14:32

I do not know where W comes into play here, but if that works for you, then so be it. :)

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Hotkey doesn't work

Post by hemsith14_ » 01 Jul 2022, 14:40

It doesn't I just used "W" in order to debug it, but I want to do it only by LButton, without W.

Post Reply

Return to “Ask for Help (v1)”