0
votes

I'm trying to create a binding where if I hold right click, it will also hold the left ctrl and left alt buttons.

On top of this, I would like to add some conditions that prevent me from doing Alt+Tab (in this case holding right click and pressing tab) or doing Ctrl+Esc. For these two conditions, I would just like to insert the raw key press, either Tab or Esc.

The problem is that although trying many different ways to go about this, the script still reads my input as Alt+Tab or Ctrl+Esc rather than Tab or Esc.

Here is my script:

#IfWinActive Guild Wars 2
#NoEnv
#Warn
SendMode Input

RButton::
    Send {RButton down}
    Send {LCtrl down}
    Send {LAlt down}
    while(GetKeyState("RButton","P")){
        if(GetKeyState("Tab", "P")){
            Send {LCtrl up}
            Send {LAlt up}
            Send {Tab}
            Send {LCtrl down}
            Send {LAlt down}
        }
        else if(GetKeyState("Esc", "P")){
            Send {LCtrl up}
            Send {LAlt up}
            Send {Esc}
            Send {LCtrl down}
            Send {LAlt down}
        }
    }
    KeyWait RButton
    Send {RButton up}
    Send {LCtrl up}
    Send {LAlt up}

#IfWinActive
1

1 Answers

0
votes

Add a delay before sending Tab/Esc:

Send {LCtrl up}
Send {LAlt up}

Sleep 1
Send {Tab}

Send {LCtrl down}
Send {LAlt down}