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