简体   繁体   English

将左键和右键单击替换为Alt + 1和Alt + 2(自动热键)

[英]Replace Left and Right Click for Alt+1 and Alt+2 (Autohotkey)

I want to send click when I press hold Alt key + 1 , and then, still holding the alt key send right-click when press the 2 key 我想在按住Alt键+ 1的同时发送点击,然后在按住2键的同时仍然按住Alt键发送右键单击

my code 我的密码

!q::

Send {LButton Down}

KeyWait q

Send {LButton Up}

Return

!w::

Send {RButton Down}

KeyWait w

Send {RButton Up}

Return

the idea is to always have pressed the ALT key, 这个想法是要一直按ALT键,

example : 例如:

!:: { q::
Send {LButton Down}

KeyWait q 

Send {LButton Up}

w:: 

Send {RButton Down} 

KeyWait w 

Send {RButton Up} 

KeyWait ! 

Return 

}

Help me please 请帮帮我

Is this what you are looking for? 这是你想要的?

!1::Click

!2::Click Right

I tested some code and I came to this conclusion. 我测试了一些代码,得出了这个结论。
You should avoid using alt key cause (you can test it) it will cause to disappear the right click menu (right click in desktop without any ahk app running. then press alt, you see that the menu disappears.) 您应该避免使用alt键原因(可以对其进行测试),这会导致右键单击菜单消失(在桌面上单击鼠标右键,而没有运行任何ahk应用程序。然后按alt键,则菜单消失了。)
So here I use the Ctrl key. 所以在这里我使用Ctrl键。

The only thing you had to add was a $ prefix. 您唯一需要添加的是$前缀。 same as below: 如下:

$^1::
    send, {lbutton down}
    keywait, 1
    send, {lbutton up}
return

$^2::
    send, {rbutton down}
    keywait, 2
    send, {rbutton up}
return

Its with Ctrl key and you can not use Alt key cause it disables the flying out menu. 它带有Ctrl键,您不能使用Alt键,因为它禁用了弹出菜单。 You can use ! 您可以使用! alt key instead of ctrl key but you have to first release alt then release 2 to prevent that menu from disappearing. alt键而不是ctrl键,但您必须先释放alt然后释放2以防止该菜单消失。

I think what you want is something like this. 我认为您想要的是这样的东西。 I figured out why it was sending repetitively and took care of it. 我弄清楚了为什么它反复发送并处理了它。 but it does not work either. 但它也不起作用。 maybe the alt key is autosending itself (i mean naturally its behavior is like this). 也许alt键是自动发送本身(我自然是说它的行为是这样的)。

$ALT::
    send, {alt down}
    keywait, ALT
return

$ALT UP::
    send, {alt up}
return

$!1::
    send, {lbutton down}
    keywait, 1
    send, {lbutton up}
return

$!2::
    send, {rbutton down}
    keywait, 2
    send, {rbutton up}
return

Another Solution is to use a key in place of the modifier: 另一种解决方案是使用键代替修饰符:

$1::
    if GetKeyState("z", "p") {
        send, {lbutton down}
        keywait, 1
        send, {lbutton up}
    }
    else {
        SetKeyDelay, -1
        Send {Blind}{1 DownTemp}
    }
return

$1 up::
    SetKeyDelay, -1
    Send {Blind}{1 Up}
return

$2::
    if GetKeyState("z", "p") {
        send, {rbutton down}
        keywait, 2
        send, {rbutton up}
    }
    else {
        SetKeyDelay, -1
        Send {Blind}{2 DownTemp}
    }
return

$2 up::
    SetKeyDelay, -1
    Send {Blind}{2 Up}
return

you can use any key instead of "z" . 您可以使用任何键代替"z" z is like the alt key. z就像alt键一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM