Home>
I tried the operation with pyautogui on a PC connected with a remote desktop and tried to execute the following code, but when I clicked the icon on the remote desktop, it says "Target not found" I get an error and won't click.
Is there a way to control remote desktop with python code?
Remote desktop icon on desktop
connectremotedesktop.png
Double click on this
Remote desktop password entry screen
After entering the password in this "Password" field, click the "OK" button below to connect to Remote Desktop
btnOK.png
IconOnRemoteDesktop.png
The python source code and each png are in the same folder
import pyautogui as gui
try:
'Double-click the remote desktop connection icon on your desktop
x, y = gui.locateCenterOnScreen ("./ connectremotedesktop.png")
gui.click (x, y, clicks = 2)
# p = gui.position ()
# gui.click (p, clicks = 2)
'Enter password for connection
gui.sleep (1)
gui.typewrite ("password")
'Click the OK button
x, y = gui.locateCenterOnScreen ("./ btnOK.png")
gui.click (x, y)
gui.sleep (5)
'This doesn't work
x, y = gui.locateCenterOnScreen ("./ IconOnRemotedesktop.png")
gui.click (x, y, clicks = 2)
except Exception as ex:
print ("Target not found.")
print (ex)
The target was not found.
cannot unpack non-iterable NoneType object
-
Answer # 1
Related articles
- how to click only when a specific button is present in python scraping
- python - pyautogui hotkey ('ctrl') does not run
- windows 10 - remote desktop does not have dual monitors
- how to make python, desktop app
- i want to click and number a few images like a switch in python
- python - how to enter confidential information of desktop applications that are supposed to be distributed
- python 3x - i want to save the csv file saved by jupyter lab on the desktop
- python - [selenium] click the radio button
- python - [selenium] i want to click the dropdown, but an error is returned
Trends
The wallpaper color on the remote desktop is probably the same as the background color of connectremotedesktop.png.
However, because the background color of IconOnRemoteDesktop.png is different, the target was not found.
Capture the Firefox icon with the same background color as connectremotedesktop.png and make it IconOnRemoteDesktop.png.
That should succeed.