Why the Rbutton Can not popup?

Get help with using AutoHotkey and its commands and hotkeys
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Why the Rbutton Can not popup?

27 Mar 2018, 04:10

Hi everyone,I met a puzzle,in the code,I cannot get the rbutton popup,why?
Thx for the help!

Code: Select all

#SingleInstance,force

RButton & WheelUp::
	tf=0
	ToolTip,test001
return
RButton & WheelDown::
	tf=0
	ToolTip,test002
return
$RButton::
	tf=1
Return
$RButton Up::
	if(tf=1)
		Send {RButton} ;MouseClick,right,0,0,1
	else
		MsgBox 003
	MsgBox % tf
Return
WalkerOfTheDay
Posts: 473
Joined: 24 Mar 2016, 03:01

Re: Why the Rbutton Can not popup?

27 Mar 2018, 04:55

I think you cannot use the $ for mouse commands.

From the guide:
AHK Bible wrote: The $ prefix has no effect for mouse hotkeys, since they always use the mouse hook. It also has no effect for hotkeys which already require the keyboard hook, including any keyboard hotkeys with the tilde (~) or wildcard (*) modifiers, key-up hotkeys and custom combinations. To determine whether a particular hotkey uses the keyboard hook, use ListHotkeys.
But your script does work. It first reacts to the right button being clicked, and after that it
reacts to the mouse button being released.

If you add a sleep to this part you will see what happens:

Code: Select all

RButton::
	tf=1
	tooltip, RButton was clicked
	sleep 2000
zhanglei1371
Posts: 19
Joined: 05 Aug 2014, 02:01

Re: Why the Rbutton Can not popup?

27 Mar 2018, 07:20

well,But still I find it doesn't work.
I test the code below:

Code: Select all

RButton up::
	MouseClick,right
return
when I run the code in a new script file ,then I fount the context menu didn't come up.
why? it's a very strange puzzle.
maybe My ahk_L's vesion?
My ahk_L's version is the latest ,v1.1.28.
What I want is that when I hold Rbutton down,if I press other key ,such as wheelup,it will run the responsive function,without Context menu popup.
But If I losen the Rbutton without press any other key,the Context Menu will come up normally.
How can I complete this ?
I have searched the whole forum for my puzzle,then I find this topic below:
https://autohotkey.com/board/topic/5501 ... mporarily/
And I have tried the code below:
Code1:

Code: Select all

$RButton::
    ScriptActive = 0
    SetTimer, TRButton, 15
Return
$RButton Up::
    SetTimer, TRButton, Off
    ScriptActive = 1
Return
TRButton:
    Send {RButton}
Return
code2:

Code: Select all

LButton & RButton::send,Keys{Home}
RButton & LButton::send,Keys{end}
$LButton::
	if !("$Rbutton" = A_PriorHotkey && A_TimeSincePriorHotkey < 500)
		Click Left
	return
$RButton::
	if !("$Lbutton" = A_PriorHotkey && A_TimeSincePriorHotkey < 500)
		Click Right
	return
unfortunately,I found the code was no use for me.Especially the code2,I found that My Lbutton and Rbutton were both invalid.
Finally I closed the process of Autohotkey.exe to exit the script.
I had tried many times.but failed at last.
So Any one know if there is a perfect soulution?
Thx for the reply!

Return to “Ask For Help”

Who is online

Users browsing this forum: 10inchOfSnow, asad41163, Google [Bot] and 222 guests