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

 

posted @ 2020-07-20 12:00  爱洗澡的猫妹  阅读(2110)  评论(0)    收藏  举报