I'm trying to automate my work using pyautogui in windows built on the cloud, but even if I start pyautogui on a session logged in with a remote connection, if I disconnect (disconnect) the remote connection during execution, the pyautogui process will not work or end with an error.
Code ↓
import time
import pyautogui aspg
pg.hotkey('alt','tab')#here and
for i in range (10):
pg.press(str(i))#This line is not processed
time.sleep(1)
Is there a way to keep pyautogui running even if you disconnect from the remote connection, or to run pyautogui without a remote connection?
■Environment
Azure VM windows 10
python 3.9.7
PyAutoGUI 0.9.53
If you are "disconnecting" a remote connection, it says, "Programs on the remote computer will continue to run after disconnecting." In fact, these issues and pywinauto documents indicate that the GUI automation operation will fail if disconnected in RDP sessions.
Windows:if you remote desktop into the PC and exit the remote session, pyautogui doesnt work#34
Unable to run pyautogui scripts from remote headless server, I can run them fine from the linux machine #87
Roadmap:Remote/headless desktops#133
Issue as a development theme is standing, but it doesn't seem to be realized.
Remote Execution Guide-pywinauto
Windows Remote Desktop features
Remote Desktop (RDP) offers virtual active desktop to remote machine with Windows OS.There are 2 potential issues:
In both cases any GUI automation jobs will fail (if you don't use some tracks descriptive below).The workarounds are well described in TestComplete documentation:
The following are possible options:There may be other things, but I think we need to experiment with them.
Note:
By the way, do you have any idea what to trigger when you run pyautogui without a remote connection?
It doesn't seem to depend on anyone's work because it's not connected.
For example, if you have a Q&A and an article like this, you might want to set the VM to auto-logon, register it in the startup folder at that logon, or register it in the Task Scheduler so that programs and scripts run.
I need to be in complete control of VM
The other option is to configure automatic logon
https://support.microsoft.com/en-us/help/324737/how-to-turn-on-automatic-logon-in-windows
and use a script or Task Scheduler to start up your application.
See above in Japanese
Enable auto-logon on the device Windows
Auto-Start (and Auto-Run?) Configuration Example Article
Tried autostarting Azure VM
© 2024 OneMinuteCode. All rights reserved.