pyautogui 远程连接鼠标无法定位(失效)


pyautogui

pywinauto是一组用于自动化Microsoft Windows GUI的python模块。最简单的是,它允许您将鼠标和键盘操作发送到Windows对话框和控件。

pyautogui官网文档链接:

https://pywinauto.readthedocs.io/en/latest/remote_execution.html

 

1.在远程的电脑上一个批处理文件,添加以下下代码,

@%windir%\System32\tscon.exe 0 /dest:console
@%windir%\System32\tscon.exe 1 /dest:console
@%windir%\System32\tscon.exe 2 /dest:console
断开远程的时候不要直接断开,运行上面的bat断开。就会保持交互状态

上面的脚本可能存在不稳定的情况,按照方式2

2.新建一个批处理文件,添加以下下代码,断开远程的时候不要直接断开,运行上面的bat断开。就会保持交互状态

for /f "skip=1 tokens=3" %%s in ('query user %USERNAME%') do (
  %windir%\System32\tscon.exe %%s /dest:console
)

 

3.远程计算机上的屏幕分辨率必须与主计算机上的屏幕分辨率相同。设置参照以下链接

https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/smart-resizing.html

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM