Search code examples
windowsautomationautoit

Is a mouse click on a remote desktop possible using AutoIt or alternatives?


I want to write a script that involves mouse click and stuff. I am little confused though. Is there a way mouse clicks (in the form of x and y co-ordinates) would work on a VPS which is logged on, but disconnected from the client?

Example:

MouseClick("left",588, 268)

To my knowledge, these VPSes don't have their own native screen resolution. I have already written the script for my local pc and it's working fine on my resolution. But when tried with the VPS, it doesn't work.

PS: I am running the script from the remote desktop itself and not from my local pc. Please correct me if there's anything I am doing wrong :)

Update: For anyone still looking for an answer, consider installing a vnc server, that way the screen resolution you specify is preserved even when not connected to the server. Ex: https://www.realvnc.com/en/connect/download/vnc/


Solution

  • It's relevant to almost any automation tool, not only AutoIt.

    Remote Desktop has its own GUI context only if it's connected to the remote PC. But you can lose focus for a Remote Desktop window (without disconnection & without minimizing) and continue other local work.

    The same effect takes place for VNC server software.

    One team in our organization uses it for massive test runs automation: a master server creates a remote session for each test machine and keeps them all connected until tests passes.