Newbie here,

I recently transitioned from Windows to Apple, and need someone to take me by hand and guide me through the process of how to click the "Reconnect" button (see screenshot) that appears after the 'Microsoft Remote Desktop' has been disconnected due to the MacBook going into sleep mode.

Once I got the script, I will need to find a way to either a) manually, or even better b) automatically run it whenever I resume work (emerging from sleep mode).

Anyone who can give me a hand here?

enter image description here

Subsequently, I adjusted my script as follows. It neither produces an error message, but unfortunately it also doesn't click the button:

    tell application "System Events"
        tell application process "Microsoft Remote Desktop" to tell window 1
            click (click at {1020, 620})
        end tell
    end tell
end try

1 Answer 1


Press Cmd+Shift+4 to get the exact coordinates where you want to click. Suppose you got the coordinates like (1065,650) then use this command in AppleScript.

   tell application "system Events"
     click(click at{1065,650})
   end tell
end try
  • Thanks, this are the coordinates: click(clck at{1020,620}) May 29 at 2:57
  • Somehow the command is not working quite yet. Getting error message: "Script doesn't understand the "clck" message." May 29 at 3:05
  • I have edited my answer above, check if it works. May 29 at 3:10
  • I also get a script error: "System Events got an error: Can’t make missing value into type UI element." May 29 at 3:16
  • I added "try" and "end try" and get no more error messages now. But still it doesn't click the button I'm trying to click. May 29 at 3:36

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .