AutoHotkey 后台点击和打字
我正在尝试使用 AutoHotkey 进行一些后台点击和打字,而我正在前台做其他事情。
我已经习惯了 Send
,但我还没有弄清楚 ControlSend
是如何工作的。任何人都可以给我一个例子,在背景中使用像 MSPaint 这样简单的东西并改变油漆的颜色。
这可能吗?我目前有一个脚本,可以从每日 Excel 报告中提取数据,为每一行分配一个变量并将其输入到另一个程序中,但我还需要它来单击并输入一些预设消息。
I'm trying to use AutoHotkey to do some background clicking and typing while I'm doing other stuff in the foreground.
I've gotten used to Send
but I haven't figured out how ControlSend
works yet. Can anyone give me an example using something simple like MSPaint in the background and changing the color of paint.
Is this even possible to do? I have a script currently that pulls from daily Excel report, assigns each row a variable and punches it into another program, but I need it to click and type some canned messages as well.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
第一个问题可能应该是为什么要使用鼠标控制?键盘控制变得更加容易,而且通常更可靠。您尝试用无法通过键盘命令完成的鼠标单击执行什么操作?
此外,鼠标点击通常会激活隐藏的应用程序。
好的,您想要一个示例...
这里我单击流媒体广播播放器的播放/暂停按钮。鼠标坐标是通过前面提到的 Windows Spy 和浏览器标题找到的(您可能必须使用 SetTitleMatchMode)。为什么不看看 AutoHotKey 命令列表并查看那里的示例......
The first question should probably be why use mouse control? Keyboard control is sooo much easier and often more reliable. What is it that you try to do with a mouseclick that can't be done through keyboard commands?
Also mouse clicks normally activate the hidden app.
OK you wanted an example...
Here i click on the play/pause button of a streaming radioplayer. The mouse coordinates are found with the aforementioned Windows Spy and the title of the browser (you might have to use SetTitleMatchMode). Why not look at the AutoHotKey Command list and check out the examples there....
让我知道这是否是您正在寻找的(大致)......
Let me know if this is (roughly) what you are looking for....
这是我用来首先记录鼠标位置的一些代码(相对鼠标位置不起作用,因为窗口是平铺的,并且可以通过移动平铺来更改单击位置)。之后,我立即在记录的位置单击鼠标(稍后也在代码中重做此操作)。
希望这有帮助。
在您的情况下,我假设您只需要使用 Window Spy 确定鼠标位置。
Here is some code I used to first record the mouse position (relative mouse position did not work since the window was tiled and the click position could be changed by moving the tiles). Immediately after that I click the mouse at the recorded position (and redo this later on in the code as well).
Hope this helps.
In your situation, I assume that you only need to determine the mouse position with Window Spy.