用于箭头键的AutoHotkey

时间:2022-11-08 17:26:24

I would like to hold

我想抱

alt + spacebar + U for the up key
alt + spacebar + H for the left arrow key
alt + spacebar + J for the right arrow key
alt  +spacebar + N for the down arrow

is this possible to do with AutoHotkey?

这可能与AutoHotkey有关吗?

2 个解决方案

#1


Hello and welcome to AutoHotkey,

您好,欢迎来到AutoHotkey,

you might want to have a look at the basic introduction to the heart of AHK, Hotkeys:

你可能想看看AHK的核心基本介绍,热键:

https://www.autohotkey.com/docs/Hotkeys.htm

Configuring hotkeys which do nothing but send another key is fairly simple. For example, alt + spacebar for the up key could be translated into

配置除了发送另一个密钥之外什么都不做的热键非常简单。例如,可以将用于向上键的alt +空格键转换为

!Space::
    send {up}
return

(note that alt is a modifier and can be written as !) or short form:

(注意alt是一个修饰符,可以写成!)或缩写形式:

!Space::send {up}

spacebar + U for the up key would be Space & U::send {up}.

用于向上键的空格键+ U将是Space&U :: send {up}。

But you are seeking for 2 keys PLUS a modifier (alt). For a hotkeylabel triggered by more than just two keys (alt + space + u), you'll need a workaround:

但是你正在寻找2键PLUS修饰符(alt)。对于由超过两个键(alt + space + u)触发的热键标签,您需要一个解决方法:

!Space::    ; once alt + space was pressed, ...
    while(getKeyState("alt") || getKeyState("space") || getKeyState("u")) { ; ... while either of these is being pressed down, ...
        hotKey, *u, altSpaceU, ON   ; u should now send {up}
    }
    hotKey, *u, altSpaceU, OFF
return

altSpaceU:  ; note: this is a label, no hotkey
    send {up}
return

Please, don't be undeterred by this. AutoHotkey is actually quite powerful and easy to learn. Sadly, (afaik) this is the only working way to solve more-than-two-key-hotkeys.

请不要被这个吓倒。 AutoHotkey实际上非常强大且易于学习。可悲的是,(afaik)这是解决超过两键热键的唯一工作方式。

EDIT jesus why didnt anybody tell me..

编辑耶稣为什么没有人告诉我..

#if getkeystate("alt")
!space::send {up}
#if

is obviously a way better solution

显然是一种更好的解决方案

#2


this was the solution !Space:: send {up} return

这是解决方案!Space :: send {up} return

#1


Hello and welcome to AutoHotkey,

您好,欢迎来到AutoHotkey,

you might want to have a look at the basic introduction to the heart of AHK, Hotkeys:

你可能想看看AHK的核心基本介绍,热键:

https://www.autohotkey.com/docs/Hotkeys.htm

Configuring hotkeys which do nothing but send another key is fairly simple. For example, alt + spacebar for the up key could be translated into

配置除了发送另一个密钥之外什么都不做的热键非常简单。例如,可以将用于向上键的alt +空格键转换为

!Space::
    send {up}
return

(note that alt is a modifier and can be written as !) or short form:

(注意alt是一个修饰符,可以写成!)或缩写形式:

!Space::send {up}

spacebar + U for the up key would be Space & U::send {up}.

用于向上键的空格键+ U将是Space&U :: send {up}。

But you are seeking for 2 keys PLUS a modifier (alt). For a hotkeylabel triggered by more than just two keys (alt + space + u), you'll need a workaround:

但是你正在寻找2键PLUS修饰符(alt)。对于由超过两个键(alt + space + u)触发的热键标签,您需要一个解决方法:

!Space::    ; once alt + space was pressed, ...
    while(getKeyState("alt") || getKeyState("space") || getKeyState("u")) { ; ... while either of these is being pressed down, ...
        hotKey, *u, altSpaceU, ON   ; u should now send {up}
    }
    hotKey, *u, altSpaceU, OFF
return

altSpaceU:  ; note: this is a label, no hotkey
    send {up}
return

Please, don't be undeterred by this. AutoHotkey is actually quite powerful and easy to learn. Sadly, (afaik) this is the only working way to solve more-than-two-key-hotkeys.

请不要被这个吓倒。 AutoHotkey实际上非常强大且易于学习。可悲的是,(afaik)这是解决超过两键热键的唯一工作方式。

EDIT jesus why didnt anybody tell me..

编辑耶稣为什么没有人告诉我..

#if getkeystate("alt")
!space::send {up}
#if

is obviously a way better solution

显然是一种更好的解决方案

#2


this was the solution !Space:: send {up} return

这是解决方案!Space :: send {up} return