Fixing Mouse button

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Nahuel
Posts: 3
Joined: 31 Mar 2023, 21:30

Fixing Mouse button

Post by Nahuel » 31 Mar 2023, 21:54

Hi, my midlle mouse button is broken so i want to replace his function by pressing and holding RMouse Button and then LMouse Button , but i cannot find how to do it

i have succes with this code that do it with double click. Hope someone can help me thank you i will realley apreciate it :)

Code: Select all

~RButton::
   If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500) {
      Sleep 200   ; wait for right-click menu, fine tune for your PC
      Send {Esc}  ; close it
      Send !{MButton}  ; your double-right-click action here
   }
Return

[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]

Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Fixing Mouse button

Post by Rohwedder » 01 Apr 2023, 02:11

Hallo,
try (with Ternary):

Code: Select all

RButton Up::SendInput,% A_PriorHotkey<>"RButton & LButton"?"{RButton}":""
RButton & LButton::MButton ; holding RMouse Button and then LMouse Button
or (with Array):

Code: Select all

RButton Up::SendInput,% ["{RButton}"][A_PriorHotkey<>"RButton & LButton"]
RButton & LButton::MButton ; holding RMouse Button and then LMouse Button
or (with ClickCount):

Code: Select all

RButton Up::Click, Right A_PriorHotkey="RButton & LButton"
RButton & LButton::MButton  ; holding RMouse Button and then LMouse Button

User avatar
Nahuel
Posts: 3
Joined: 31 Mar 2023, 21:30

Re: Fixing Mouse button

Post by Nahuel » 01 Apr 2023, 05:06

Rohwedder wrote: Hallo,
try (with Ternary):

Code: Select all

RButton Up::SendInput,% A_PriorHotkey<>"RButton & LButton"?"{RButton}":""
RButton & LButton::MButton ; holding RMouse Button and then LMouse Button
or (with Array):

Code: Select all

RButton Up::SendInput,% ["{RButton}"][A_PriorHotkey<>"RButton & LButton"]
RButton & LButton::MButton ; holding RMouse Button and then LMouse Button
or (with ClickCount):

Code: Select all

RButton Up::Click, Right A_PriorHotkey="RButton & LButton"
RButton & LButton::MButton  ; holding RMouse Button and then LMouse Button
Hallooo :) , thank you for replying, i tried your code and it works well, the only problem, is that it affects RMouse file dragging and stop working, that i use a lot in windows explorer, it would be perfect if there is a way to work that around.

In my other code it dosen't affect draggin, mm maybe is because keys holding i think but i'm not sure :/

Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Fixing Mouse button

Post by Rohwedder » 01 Apr 2023, 06:30

Then perhaps?:

Code: Select all

~RButton Up::SendInput,% ["{Esc}"][A_PriorHotkey="LButton Up"]
#IF GetKeyState("RButton","P")
LButton::SendInput, {RButton Up}{Esc}{MButton Down}
LButton Up::SendInput, {MButton Up}
#IF

User avatar
Nahuel
Posts: 3
Joined: 31 Mar 2023, 21:30

Re: Fixing Mouse button

Post by Nahuel » 01 Apr 2023, 15:46

Rohwedder wrote:
01 Apr 2023, 06:30
Then perhaps?:
[Mod edit: Fixed quote tags.]

Well that code messed up my focus, to the point i have had to restart my computer jaja it kinda messed up my resolution when locking my user lol, i also noticed that in my code or yours, the midlle mouse action only shows in internet browsers , but not in windows explorer, i think that is fixeable

Rohwedder
Posts: 7616
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Fixing Mouse button

Post by Rohwedder » 02 Apr 2023, 04:15

Here it works in windows explorer.
Perhaps?: https://www.autohotkey.com/docs/v1/FAQ.htm#uac

(I don't understand the gamers! Curved square meter monitors all around, processors cooled with liquid nitrogen but a lousy mouse.)

Post Reply

Return to “Ask for Help (v1)”