Multi button: How to do something like this?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
fona
Posts: 65
Joined: 07 Apr 2022, 06:43

Multi button: How to do something like this?

Post by fona » 31 Jan 2023, 08:13

Hello guys,
If I hold down my RButton, then I hear soundbeep. A normal RButton if I press it quickly. Okay. What I want to do is that I want Alt to be pressed down in the beginning instead of waiting for T0.1. The problem is that it waits here till I release the RButton, and therefore I don't hear the soundbeep. Is it possible to have Alt pressed down and still have multi button working properly as well? Thanks in advance.

Code: Select all

RButton::
	SendInput {Alt down}
	KeyWait RButton
	SendInput {Alt up}
	
	KeyWait, RButton, T0.1. ; Check if mouse button get's released immediately
	if (ErrorLevel = 1){ ; Button is still down
		SoundBeep 900
		}
			else{
			SendInput {RButton}
		}
	return

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

Re: Multi button: How to do something like this?

Post by mikeyww » 31 Jan 2023, 10:37

Code: Select all

#Requires AutoHotkey v1.1.33
RButton::
KeyWait RButton, T.2
If ErrorLevel {  ; Held
 Click R
 SoundBeep 1500
} Else {         ; Not held
 Send {Alt down}
 SoundBeep 1000
}
KeyWait RButton
Send {Alt up}
Return
A different one:

Code: Select all

#Requires AutoHotkey v1.1.33
RButton::
Send {Alt down}
KeyWait RButton, T.2
If ErrorLevel {  ; Held
 Click R
 SoundBeep 1500
} Else SoundBeep 1000
KeyWait RButton
Send {Alt up}
Return

fona
Posts: 65
Joined: 07 Apr 2022, 06:43

Re: Multi button: How to do something like this?

Post by fona » 31 Jan 2023, 16:42

mikeyww wrote:
31 Jan 2023, 10:37

Code: Select all

#Requires AutoHotkey v1.1.33
RButton::
KeyWait RButton, T.2
If ErrorLevel {  ; Held
 Click R
 SoundBeep 1500
} Else {         ; Not held
 Send {Alt down}
 SoundBeep 1000
}
KeyWait RButton
Send {Alt up}
Return
A different one:

Code: Select all

#Requires AutoHotkey v1.1.33
RButton::
Send {Alt down}
KeyWait RButton, T.2
If ErrorLevel {  ; Held
 Click R
 SoundBeep 1500
} Else SoundBeep 1000
KeyWait RButton
Send {Alt up}
Return
Unfortunately, it doesn't work the way I want it to work. I would like to have a normal RButton if I press Rbutton. Moreover, when I press and hold down the RButton the Alt should be pressed down until I release the RButton without waiting for T.2. Now I doubt it's possible to implement:)

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

Re: Multi button: How to do something like this?

Post by mikeyww » 31 Jan 2023, 18:52

Code: Select all

#Requires AutoHotkey v1.1.33
RButton::
Send {Alt down}
KeyWait RButton, T.2
If ErrorLevel { ; Held
 SoundBeep 2000
 KeyWait RButton
 Send {Alt up}
} Else Send {Alt up}{Esc}{RButton}
Return

Post Reply

Return to “Ask for Help (v1)”