Microsoft Remote Desktop

@tatarin, OK, no problem. I'll walk you through it.

You have two options to get the UI elements and AppleScript to click on them:

  1. UI Browser
  2. Use the below macro with BBEdit

Make your choice and download/install the indicated files/tools.

Option #1

Using UI Browser is probably the simplest.
You can download and install it, and run the trial version (free) for 15 uses I think.

To learn how to use it, see

  1. Tutorial: Using Keyboard Maestro and UI Browser
    • A great video by one of our Forum gurus, @DanThomas
  2. UI Browser Videos and other pages on its web site.

Steps to Get UI Script

(these are approximate steps, more like guidance)

  1. Open MS Remote Desktop, and make the window of interest frontmost
  2. Open UI Browser, and click the button "Switch to Screen Reader"
  3. Move the Mouse over the MS RD, and over the objects you want to click on
  4. Press ⌘⌃⇧S to capture the UI elements and open in the browser view
  5. Click the "AppleScript" button and select "Tell Block Wrapper Short"
  6. Click the "AppleScript" button and select "Click selected element"
  7. Copy and paste this script into SE/SD AFTER the line "-- insert GUI Scripting statements here:"
  8. You can now try to compile and run the script.

If you still need help, post the script in a reply, using a Code Block.

Option #2

We will be using my version of Chris @ccstone's macro.
Please download and import into your KM.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@Win List UI Elements of Front Window @FAV.kmmacros (15 KB)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  1. After you import it into KM (just double-click the ".kmmacros" file), you will need to:
    1. Enable it
    2. Assign a trigger. I like a hot key of ⌃F1, but you can use whatever you prefer.
      .
  2. Make sure you have BBEdit installed.
    • If you don't have BBEdit already installed, I highly recommend it. It is the best plain text editor available, and has a free version.
      .
  3. Now, open your MS Remote Desktop, and make sure the window of interest if frontmost.
  4. Then trigger the macro.
    • This may take a few seconds, and will open the results in BBEdit.
  5. Save the file in BBEdit, and zip it.
  6. Upload the zip file (drag/drop, or copy/paste, or use the Forum Editor upload button) to a reply post in this thread.

I'll get notice of your reply and will download and analyze the zipped file.
It should provide us with a hierarchical listing of the UI elements of the MS Remote Desktop window. From that, I should be able to write an AppleScript that will click on the desired Desktops shown in the window.