gpt4 book ai didi

How to bind L-click to keybind, but only when not typing (in AHK)?(如何绑定L的按键绑定,但只能在不打字的情况下(AHK)?)

转载 作者:bug小助手 更新时间:2023-10-28 11:23:57 26 4
gpt4 key购买 nike



I am a total AHK newbie. I just recently discovered the joy of being able to click by binding L-click to a keyboard key. I bound it to my letter "D" key, however I then ran into what should have been an obvious problem of now not being able to type the letter "D" at all. The script I am using is just:

我是一个完全的AHK新手。我最近才发现,通过将L-click绑定到键盘键上,能够进行点击的乐趣。我把它绑定到我的字母“D”键上,然而我随后遇到了一个明显的问题,那就是现在根本不能打字母“D”。我使用的脚本是:


D::LButton

D::LButton


Whenever I try to type "D", it just clicks wherever my mouse is.

每当我试图输入“D”时,它只是点击我的鼠标所在的位置。


Is there a way to bind L-click to my D key, but have it **NOT **trigger when pressing "D" in a typing field (e.g. the URL bar, or when a cell in Google Sheets is double-clicked, or when you press Enter to type in a video game, etc)? I basically want to be able to type "D" when a typing field is focused, while being able to L-click with "D" (i.e. trigger the script) when a typing field is not focused.

有没有办法将L的点击绑定到我的D键上,但在输入字段(例如,地址栏,或者当双击Google Sheets中的单元格,或者当您按Enter键输入视频游戏时,等等)时**不**触发?我基本上希望能够在输入字段被聚焦时输入“D”,而在输入字段未被聚焦时能够用“D”按住L的键(即触发脚本)。


If someone could lend some advice, it would be very much appreciated. Thank you

如果有人能给我们提些建议,我们将不胜感激。谢谢


更多回答

I can pretty much guarantee there is no way you can make this work flawlessly. As you can see from the one answer this question has, there is something you can do about this, but you can't always accurately tell when you're on some input field that wants input, and when not. If you only use this script part time, I guess then some half solution like that can work for you. But if you want to use a script like this 247, I'd recommend you instead bind something not so commonly used, or maybe have some quick hotkey to toggle your remap on/off.

我几乎可以保证,你不可能把这个工作做得完美无瑕。正如您可以从这个问题的一个答案中看到的那样,您可以对此做些什么,但您不能总是准确地分辨出您在某个输入域中何时需要输入,何时不需要输入。如果你只是部分时间使用这个脚本,我想一些类似的解决方案可以为你工作。但是如果你想使用像247这样的脚本,我建议你绑定一些不太常用的东西,或者使用一些快速热键来打开/关闭你的重新映射。

优秀答案推荐

AHK v1:

AHK v1:


The #If directive creates context-sensitive hotkeys and hotstrings:

#if指令创建上下文相关的热键和热串:


#Requires AutoHotkey v1.1

#If (A_Cursor != "IBeam") ; the mouse pointer is not in text input mode

d::LButton

#If

AHK v2:

AHK v2:


The #HotIf directive creates context-sensitive hotkeys and hotstrings:

#HotIf指令创建上下文相关的热键和热串:


#Requires AutoHotkey v2.0

#HotIf (A_Cursor != "IBeam")

d::LButton

#HotIf

更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com