简体   繁体   English

AutoHotKey:重新映射Alt,Ctrl和Alt + Ctrl

[英]AutoHotKey: Remap Alt, Ctrl, and Alt+Ctrl

I'd like to use AutoHotKey to remap: 我想使用AutoHotKey重新映射:

RAlt::Volume_Down
RCtrl::Volume_Up
RAlt & RCtrl::SendInput {Volume_Mute}

While Vol up works fine with the script as above, vol down is non-repeating & mute only works if the buttons are pressed as Alt,Ctrl (not Ctrl,Alt). 虽然Vol up在上述脚本中可以正常使用,但vol down是不可重复的,并且只有在按Alt,Ctrl(不是Ctrl,Alt)的情况下按下静音才能起作用。 I understand why, I just haven't been able to come up with a solution. 我知道为什么,我只是无法提出解决方案。 I can map either volume up/down or mute - but if I try to do both, the behavior is always finicky. 我可以映射或者音量加/减静音-但如果我尝试做两件事,行为永远是挑剔的。 I think what I need is something to the effect of: 我认为我需要的是以下方面的作用:

if GetKeyState("RAlt") and GetKeyState("RCtrl")
{
    SendInput {Volume_Mute}
}
else if GetKeyState("RAlt")
{
    SendInput {Volume_Down}
}
else if GetKeyState("RCtrl")
{
    SendInput {Volume_Up}
}

But this just runs & terminates. 但这只是运行并终止。 Is there a way to achieve what I'm after? 有没有办法实现我的追求?

The problem with your solution is that RAlt & RCtrl::SendInput {Volume_Mute} turns RAlt into a "prefix key" and according to the Hotkeys section of Autohotkey help " The prefix key loses its native function ". 解决方案的问题是RAlt & RCtrl::SendInput {Volume_Mute}RAlt变成了“前缀键”,并且根据Autohotkey帮助的“ Hotkeys”部分,“ 前缀键会失去其本机功能 ”。

Try this instead: 尝试以下方法:

RAlt::Volume_Down
RCtrl::Volume_Up

#if GetKeyState("RAlt", "P")
RCtrl::Volume_Mute

#if GetKeyState("RCtrl", "P")
RAlt::Volume_Mute

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

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