Long press RButton

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Long press RButton

25 Apr 2022, 12:43

Só I want to long press the mouse right button to open the on screen keyboard and I managed to do that but I want the context menu to appear just when I click and not when I long press it and I can't figure out how. This is what I have, it works but the context menu is annoying...

Code: Select all

$*rbutton::
Send {Blind}{rbutton}
KeyWait, rbutton, T0.6
If ErrorLevel {
	Run, osk.exe
IfWinExist, ahk_exe osk.exe
	WinHide,  ahk_exe osk.exe
else
	WinShow,  ahk_exe osk.exe
return
	KeyWait, rbutton
}
return
[Mod edit: quote tags replaced with [code][/code] tags.]
Descolada
Posts: 1202
Joined: 23 Dec 2021, 02:30

Re: Long press RButton

25 Apr 2022, 13:40

You can have
1) Context menu appear right after pressing down RButton and make it disappear when long holding (which is the solution you are using now)
2) Nothing appear after pressing down RButton, then EITHER have on-screen keyboard launch after holding RButton down for some time OR context menu launch after releasing RButton before that time. Example:

Code: Select all

$*rbutton::
	KeyWait, rbutton, T0.6
	If ErrorLevel {
		Run, osk.exe
		IfWinExist, ahk_exe osk.exe
			WinHide,  ahk_exe osk.exe
		else
			WinShow,  ahk_exe osk.exe
	} Else
		Click, Right
	return
You cannot have the context menu appear after right-clicking AND context menu not appear when you want to long-press for on-screen keyboard. To make that happen the script would need to read your mind. :)
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: Long press RButton

25 Apr 2022, 14:27

Thank you so much, your script is exactly what I was looking for. I'm grateful for your time. :clap: :clap: :clap:
Last edited by sulphuricsaliva on 25 Apr 2022, 14:37, edited 1 time in total.
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: Long press RButton

25 Apr 2022, 14:36

I know this might be a stretch, but I have a script that let's me hold right click and click left to do alt tab. Do you think there's any way I can combine these two?
$*rbutton::
KeyWait, rbutton, T0.6
If ErrorLevel {
Run, osk.exe
IfWinExist, ahk_exe osk.exe
WinHide, ahk_exe osk.exe
else
WinShow, ahk_exe osk.exe
} Else
Click, Right
return


Rbutton & lbutton::Send, ^!{Tab}
return
Tried it as is but it creates conflict and only the alt tab works. Basicly I need a code that allows me to click the lbutton within T.06 to do ^!{Tab}. It would be genius if I could combine these two, it would add so much functionality to my mouse using my média center pc.
Descolada
Posts: 1202
Joined: 23 Dec 2021, 02:30

Re: Long press RButton

25 Apr 2022, 14:54

Does it work with this?

Code: Select all

~Rbutton & lbutton::Send, ^!{Tab}
return
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: Long press RButton

25 Apr 2022, 15:01

No, when I put the ctrl alt tab in the same script the on screen keyboard doesn't work.
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: Long press RButton

25 Apr 2022, 17:39

I didn't notice the change you made to the code, can't believe It's working. Thank you so much for help, this'll be so useful :dance: :dance: :bravo:

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Mateusz53, MrHue, mstrauss2021, Rohwedder and 309 guests