0

我想在 COPY 之后做一个ALT+ :TAB

hs.eventtap.keyStroke({"cmd"}, "C")

在此代码中,用户来源:@user3439894

所以,通常它会是这样的,正如@Oka 所建议的那样:

hs.eventtap.keyStroke({"alt"}, "tab")

和这个:

hs.eventtap.keyStroke({"alt"}, {"tab"})

但这不起作用。或者我可能把它放在错误的地方。

而且我不知道如何使用 Oka 的这些建议:

pushkeycode(L, kVK_Tab, "tab");

由@user3439894 在此其他帖子中解决

4

1 回答 1

0

本期中,使用的正确字符串据说是"tab".

在对keycodes扩展源代码进行了一些挖掘之后,我们可以确认这一点。

来自keycodes.lua

--- hs.keycodes.map
--- Constant
--- A mapping from string representation of a key to its keycode, and vice versa.
--- For example: keycodes[1] == "s", and keycodes["s"] == 1, and so on.
--- This is primarily used by the hs.eventtap and hs.hotkey extensions.
---
--- Valid strings are any single-character string, or any of the following strings:
---
---     f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15,
---     f16, f17, f18, f19, f20, pad., pad*, pad+, pad/, pad-, pad=,
---     pad0, pad1, pad2, pad3, pad4, pad5, pad6, pad7, pad8, pad9,
---     padclear, padenter, return, tab, space, delete, escape, help,
---     home, pageup, forwarddelete, end, pagedown, left, right, down, up,
---     shift, rightshift, cmd, rightcmd, alt, rightalt, ctrl, rightctrl,
---     capslock, fn

keycodes_cachemap我们可以在函数中看到这个设置libkeycodes.m

pushkeycode(L, kVK_Tab, "tab");
于 2021-11-29T17:43:46.330 回答