gpt4 book ai didi

autohotkey - Send 和 ControlSend 有什么区别?

转载 作者:行者123 更新时间:2023-12-05 02:18:21 24 4
gpt4 key购买 nike

AutoHotkey 的官方文档列出了两组不同的命令,用于将模拟键盘输入发送到窗口。

Send / SendRaw / SendInput / SendPlay / SendEvent

Sends simulated keystrokes and mouse clicks to the active window.

ControlSend / ControlSendRaw

Sends simulated keystrokes to a window or control.


  • Send 和 ControlSend 有什么区别?
  • 是否有理由使用一个而不是另一个?

最佳答案

Send/SendXXX 命令将输入​​发送到事件窗口。这是当前具有焦点 的窗口,通常是通过用鼠标单击它、使用 Tab 键指向它,或者当窗口将焦点设置到自身时。

如果您的 AHK 脚本以您打开的记事本窗口为目标,并且您要单击另一个窗口(例如 Chrome),您的输入现在将发送到 Chrome。

另一方面,使用 ControlSend/ControlSendXXX 命令会将输入发送到指定的窗口控件。控件可以是文本框、按钮或类似的交互元素。

在这里,即使您将焦点切换到另一个窗口(例如 Chrome),上面的示例仍会输出到记事本。缺点是您必须指定要发送到哪个控件。

关于autohotkey - Send 和 ControlSend 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45515391/

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