XMove/Xclick Relative to plusSymbol.png

Hi All,

Encountered a problem when automating on desktop, I have to click a specific tab in a software however that tab name will always change so I cannot use xclick ‘screenshotoftab.png’.

However the tab will always be next to a plus symbol. Is there a way in which I can use the plusSymbol as a screenshot to move the mouse to it and then say move mouse x amount to the left and xclick. I have tried all xmodules like xclickrelative, xmoverelative to no avail. Am I completely missing something?

Please see screenshot for hopefully a better example:

I know this isn’t entirely correct code, but something of this logic, is what I am trying to achieve.

{
  "Name": "ClickRelativeToPlusSymbol",
  "CreationDate": "2024-07-02",
  "Commands": [
    {
      "Command": "XMove",
      "Target": "plusSymbol.png",
      "Value": "",
      "Description": "Move the mouse to the + symbol"
    },
    {
      "Command": "XMoveRelative",
      "Target": "-3,0",
      "Value": "",
      "Description": "Move 3 pixels to the left of the + symbol"
    },
    {
      "Command": "XClick",
      "Target": "",
      "Value": "",
      "Description": "Click at the current position"
    }
  ]
}

Thanks in advance.

XMoveRelative does not work with coordinates, but uses the green/pink box logic inside the input image. In your case the “+” symbol is the anchor image (green box) and the pink image is placed somewhere on the tab (area to click). This should work:

XMoveRelative | image1.png

The image should be this:

Thanks Ulrich, I believe this has worked. I was hesitant to use xclickrelative as I wasn’t sure that if the text on the tab changed on the next loop of the macro it would actually work…

I can confirm that with all ...relative commands, everything outside the green box is ignored when the image search is done.

Great thanks all, this has been solved then. This is a massive help!