问题描述
我似乎找不到这个问题的具体答案.如何在不移动光标的情况下单击屏幕上的坐标?我正在从事一个项目,该项目将自动安装程序,但仍希望在处理安装时控制鼠标执行其他任务.有任何想法吗?一些例子也很棒.
I can't seem to find a specific answer to this question. How do I click coordinates on the screen without moving the cursor? I am working on a project that will automate installations of programs, but would still like control of the mouse to do other tasks while installations are being processed. Any ideas? Some examples would be awesome as well.
推荐答案
感谢那些试图帮助我的人.经过进一步研究,我找到了解决方案.我找到了一种使用 PyAutoIt 将 AutoIt 导入 Python 的方法.我一直在寻找一个 ControlClick 函数,它可以在不移动鼠标光标的情况下单击控件.下面是一个例子:
Thank you to those who have tried to help me out. After further research I have found a solution. I have found a way to import AutoIt into Python by using PyAutoIt. There is a ControlClick function that I have been looking for that clicks a control without moving the mouse cursor. Here is an example:
import autoit
import time
autoit.run("notepad.exe")
autoit.win_wait_active("[CLASS:Notepad]", 3)
autoit.control_send("[CLASS:Notepad]", "Edit1", "hello world{!}")
time.sleep(5)
autoit.win_close("[CLASS:Notepad]")
autoit.control_click("[Class:#32770]", "Button2")
再次感谢.此线程可以标记为已回答和已关闭:)
Thanks again. This thread can be marked answered and closed :)
这篇关于鼠标点击而不移动光标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!