Changing logical state of the key not using Send command
I have a code that includes "RButton up::return" for disabling context menu when other hotkeys, RButton & Wheelup/down, is executed and this code seems to keep pressing RButton. Here's my code :
global RButtonDisable := 0 ;initial variable setting
RButton::RButton ;I don't know why but execpt this line, context menu
;pop up after ~RButton & Wheelup/down hotkeys
~RButton & Wheelup::
Send ^+{Tab}
RButtonDisable := 1 ;when this value is 1, activate #If
SetTimer RButtonRecover, -1
return
~RButton & Wheeldown::
Send ^{Tab}
RButtonDisable := 1
SetTimer RButtonRecover, -1
return
#If RButtonDisable ;disabling RButton when hotkeys above are executed
RButton::return
RButton up::return ;this line is needed because context menu pop up
;when RButton is up
#If
RButtonRecover: ;enabling RButton again
KeyWait RButton
Sleep 10
RButtonDisable := 0
Goto RButton
return
My goal is disabling context menu only when ~RButton & Wheelup/down hotkeys are executed. This code is working but, I think, because of RButton up::return, my computer recognize RButton is keep pressed which ends up ruin other tasks. So what I want to do is one of two things
- Changing logical state of RButton from up to down after the ~RButton & Wheelup/down hotkeys, not executing context menu.
- Disabling RButton with different code approach.
I posted about this question before and found out how to remove context menu : https://www.reddit.com/r/AutoHotkey/comments/14i9fbc/send_esc_right_after_hotkey_routine_is_over/ . But this time I want to make context menu not executed from the start. Can anybody gives some solution?