XMove XMovetext X Command Position Retrieval

I encountered an issue while using the XMove or XMovetext X commands to store initial coordinates. Specifically, when storing the initial position (e.g., via `store|${ocrX},${ocrY}|coordinates_first`), the variable `${coordinates_first}` appears to dynamically update to the latest coordinates instead of retaining the original values. Consequently, I am unable to reference the initial position after moving to a new location.

Could you advise on how to correctly retrieve the initial coordinates using the Xmove or similar X command?

**Environment**: Windows 10, Microsoft Edge, UI.Vision IDE 9.5.3.

Refer to the dump : the X command locate text “Putin” postion

Please refer to script as below:

```javascript

{
“Name”: “5_Testing-OCR”,
“CreationDate”: “2025-10-20”,
“Commands”: [
{
“Command”: “store”,
“Target”: “!OCRLanguage=eng”,
“Value”: “”,
“Description”: “!OCRLanguage=chs eng”
},
{
“Command”: “store”,
“Target”: “99”,
“Value”: “!ocrEngine”,
“Description”: “XModule 99; Javascript 98; ”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!OCRScale”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!OCRTableExtraction”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “60”,
“Value”: “!TIMEOUT_PAGELOAD”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “60”,
“Value”: “!TIMEOUT_WAIT”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “true”,
“Value”: “!errorignore”,
“Description”: “”
},
{
“Command”: “XDesktopAutomation”,
“Target”: “false”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “open”,
“Target”: “http://en.ce.cn/main/latest/202510/t20251017_2522918.shtml”,
“Value”: “”,
“Description”: “”
},
{
“Command”: “XMouseWheel”,
“Target”: “3”,
“Value”: “”,
“Description”: "负上 ,正下 移动 "
},
{
“Command”: “echo”,
“Target”: “${!ocrX} , ${!ocrY}”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “visionLimitSearchArea”,
“Target”: “viewport”,
“Value”: “”,
“Description”: “full/viewport/area=184,297,1818,888”
},
{
“Command”: “OCRSearch”,
“Target”: “Putin”,
“Value”: “a”,
“Description”: “Putin”
},
{
“Command”: “echo”,
“Target”: “${a}”,
“Value”: “red”,
“Description”: “”
},
{
“Command”: “XMoveText”,
“Target”: “Putin@pos=1”,
“Value”: “”,
“Description”: “Putin@pos=1”
},
{
“Command”: “echo”,
“Target”: “${!ocrX} , ${!ocrY}”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “store”,
“Target”: “${!ocrX},${!ocrY}”,
“Value”: “coordinates_first”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${coordinates_first}”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “XMoveText”,
“Target”: “Putin@pos=2”,
“Value”: “”,
“Description”: “Putin@pos=1”
},
{
“Command”: “echo”,
“Target”: “${!ocrX} , ${!ocrY}”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “XMoveTextRelative”,
“Target”: “Putin@pos=2#R0,-20”,
“Value”: “”,
“Description”: “Putin#R0,-20”
},
{
“Command”: “echo”,
“Target”: “${!ocrX} , ${!ocrY}”,
“Value”: “blue”,
“Description”: “”
},
{
“Command”: “XClick”,
“Target”: “${coordinates_first}”,
“Value”: “”,
“Description”: “Putin@pos=1”
},
{
“Command”: “echo”,
“Target”: “${!ocrX} , ${!ocrY}”,
“Value”: “green”,
“Description”: “”
},
{
“Command”: “OCRExtractbyTextRelative”,
“Target”: “Putin@pos=2#R-5,-1H10W50”,
“Value”: “extractresult”,
“Description”: “”
},
{
“Command”: “echo”,
“Target”: “${extractresult}”,
“Value”: “blue”,
“Description”: “”
}
]
}

```

Please refer to script log:

```javascript

  • status]

    Playing macro 5_Testing-OCR
    
  • [info]

    Executing:  | store | !OCRLanguage=eng |  | 
    
  • [info]

    Executing:  | store | 99 | !ocrEngine | 
    
  • [info]

    Executing:  | store | true | !OCRScale | 
    
  • [info]

    Executing:  | store | true | !OCRTableExtraction | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_PAGELOAD | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_WAIT | 
    
  • [info]

    Executing:  | store | true | !errorignore | 
    
  • [info]

    Executing:  | XDesktopAutomation | false |  | 
    
  • [info]

    Executing:  | open | http://en.ce.cn/main/latest/202510/t20251017_2522918.shtml |  | 
    
  • [info]

    Executing:  | XMouseWheel | 3 |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    0  ,  0
    
  • [info]

    Executing:  | visionLimitSearchArea | viewport |  | 
    
  • [info]

    Executing:  | OCRSearch | Putin | a | 
    
  • [info]

    OCR (chs) started (151.3 KB)
    
  • [info]

    OCR result received (2.2s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${a} | red | 
    
  • [echo]

    4
    
  • [info]

    Executing:  | XMoveText | Putin@pos=1 |  | 
    
  • [info]

    OCR (chs) started (124.7 KB)
    
  • [info]

    OCR result received (1.7s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    245.5  ,  85
    
  • [info]

    Executing:  | store | ${!ocrX},${!ocrY} | coordinates_first | 
    
  • [info]

    Executing:  | echo | ${coordinates_first} | green | 
    
  • [echo]

    245.5,85
    
  • [info]

    Executing:  | XMoveText | Putin@pos=2 |  | 
    
  • [info]

    OCR (chs) started (128.5 KB)
    
  • [info]

    OCR result received (1.5s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    93.5  ,  216.5
    
  • [info]

    Executing:  | XMoveTextRelative | Putin@pos=2#R0,-20 |  | 
    
  • [info]

    OCR (chs) started (129.1 KB)
    
  • [info]

    OCR result received (1.5s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    74  ,  350
    
  • [info]

    Executing:  | XClick | ${coordinates_first} |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    74  ,  350
    
  • [info]

    Executing:  | OCRExtractbyTextRelative | Putin@pos=2#R-5,-1H10W50 | extractresult | 
    
  • [info]

    OCR (chs) started (128.0 KB)
    
  • [info]

    OCR result received (1.6s from XModule OCR)
    
  • [info]

    OCR (chs) started (17.2 KB)
    
  • [info]

    OCR result received (0.9s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${extractresult} | blue | 
    
  • [echo]

    the Russia-Ukraine conflict, following a phl
    ersation the two leaders.
    
    
  • [info]

    Macro completed (Runtime 39.42s)
    
  • [status]

    Playing macro 5_Testing-OCR
    
  • [info]

    Executing:  | store | !OCRLanguage=eng |  | 
    
  • [info]

    Executing:  | store | 99 | !ocrEngine | 
    
  • [info]

    Executing:  | store | true | !OCRScale | 
    
  • [info]

    Executing:  | store | true | !OCRTableExtraction | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_PAGELOAD | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_WAIT | 
    
  • [info]

    Executing:  | store | true | !errorignore | 
    
  • [info]

    Executing:  | XDesktopAutomation | false |  | 
    
  • [info]

    Executing:  | open | http://en.ce.cn/main/latest/202510/t20251017_2522918.shtml |  | 
    
  • [error][ignored]

    Line 9: Error #102: Lost contact to website
    
  • [info]

    Executing:  | XMouseWheel | 3 |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    0  ,  0
    
  • [info]

    Executing:  | visionLimitSearchArea | viewport |  | 
    
  • [info]

    Executing:  | OCRSearch | Putin | a | 
    
  • [info]

    OCR (chs) started (146.8 KB)
    
  • [info]

    OCR result received (4.1s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${a} | red | 
    
  • [echo]

    4
    
  • [info]

    Executing:  | XMoveText | Putin@pos=1 |  | 
    
  • [info]

    OCR (chs) started (146.8 KB)
    
  • [info]

    OCR result received (2.7s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    688  ,  237.5
    
  • [info]

    Executing:  | store | ${!ocrX},${!ocrY} | coordinates_first | 
    
  • [info]

    Executing:  | echo | ${coordinates_first} | green | 
    
  • [echo]

    688,237.5
    
  • [info]

    Executing:  | XMoveText | Putin@pos=2 |  | 
    
  • [info]

    OCR (chs) started (151.2 KB)
    
  • [info]

    OCR result received (2.0s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    952.5  ,  396
    
  • [info]

    Executing:  | XMoveTextRelative | Putin@pos=2#R0,-20 |  | 
    
  • [info]

    OCR (chs) started (150.9 KB)
    
  • [info]

    OCR result received (2.0s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    937  ,  531
    
  • [info]

    Executing:  | XClick | ${coordinates_first} |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    937  ,  531
    
  • [info]

    Executing:  | OCRExtractbyTextRelative | Putin@pos=2#R-5,-1H10W50 | extractresult | 
    
  • [info]

    OCR (chs) started (151.3 KB)
    
  • [info]

    OCR result received (1.9s from XModule OCR)
    
  • [info]

    OCR (chs) started (7.1 KB)
    
  • [info]

    OCR result received (1.0s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${extractresult} | blue | 
    
  • [echo]

    e one,• said Trump on Truth Sccial.
    
    
  • [info]

    Macro completed (Runtime 52.18s)
    

```

Your macro looks almost ok. Regular variables like ${coordinates_first} do not dynamically update. They retain the original values, unless they are explicitly updated with STORE or similar commands.

I think see the issue. You need to store each x/y value in its own variable, so this should work:

  • store | ${!ocrX} | coordinates_first_x |
  • store | ${!ocrY} | coordinates_first_y |

Thank you for your prompt response. Actually, I attempted to store each X/Y coordinate value as a variable, but the operation was unsuccessful. Even use the executeScript/executeScript_Sandbox commands to store the variable value.

Please refer to the below updated script log.
[status]

Playing macro 5_Testing-OCR
  • [info]

    Executing:  | store | !OCRLanguage=eng |  | 
    
  • [info]

    Executing:  | store | 99 | !ocrEngine | 
    
  • [info]

    Executing:  | store | true | !OCRScale | 
    
  • [info]

    Executing:  | store | true | !OCRTableExtraction | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_PAGELOAD | 
    
  • [info]

    Executing:  | store | 60 | !TIMEOUT_WAIT | 
    
  • [info]

    Executing:  | store | true | !errorignore | 
    
  • [info]

    Executing:  | XDesktopAutomation | false |  | 
    
  • [info]

    Executing:  | open | http://en.ce.cn/main/latest/202510/t20251017_2522918.shtml |  | 
    
  • [info]

    Executing:  | XMouseWheel | 3 |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    0  ,  0
    
  • [info]

    Executing:  | visionLimitSearchArea | viewport |  | 
    
  • [info]

    Executing:  | OCRSearch | Putin | a | 
    
  • [info]

    OCR (chs) started (146.5 KB)
    
  • [info]

    OCR result received (1.8s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${a} | red | 
    
  • [echo]

    4
    
  • [info]

    Executing:  | XMoveText | Putin@pos=1 |  | 
    
  • [info]

    OCR (chs) started (146.5 KB)
    
  • [info]

    OCR result received (1.6s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    688  ,  237.5
    
  • [info]

    Executing:  | store | ${!ocrX} | coordinates_first_x | 
    
  • [info]

    Executing:  | store | ${!ocrY} | coordinates_first_y | 
    
  • [info]

    Executing:  | echo | ${coordinates_first_x} , ${coordinates_first_y} | green | 
    
  • [echo]

    688 , 237.5
    
  • [info]

    Executing:  | executeScript_Sandbox | var c=${!ocrX}+','+${!ocrY};return c; | coordinates_first | 
    
  • [info]

    Executing:  | echo | ${coordinates_first} | red | 
    
  • [echo]

    688,237.5
    
  • [info]

    Executing:  | XMoveText | Putin@pos=2 |  | 
    
  • [info]

    OCR (chs) started (146.5 KB)
    
  • [info]

    OCR result received (1.7s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    952.5  ,  396
    
  • [info]

    Executing:  | XMoveTextRelative | Putin@pos=2#R0,-20 |  | 
    
  • [info]

    OCR (chs) started (146.5 KB)
    
  • [info]

    OCR result received (1.7s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | blue | 
    
  • [echo]

    937  ,  531
    
  • [info]

    Executing:  | XMove | ${coordinates_first_x},${coordinates_first_y} |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | green | 
    
  • [echo]

    937  ,  531
    
  • [info]

    Executing:  | XMove | ${coordinates_first} |  | 
    
  • [info]

    Executing:  | echo | ${!ocrX}  ,  ${!ocrY} | red | 
    
  • [echo]

    937  ,  531
    
  • [info]

    Executing:  | OCRExtractbyTextRelative | Putin@pos=2#R-5,-1H10W50 | extractresult | 
    
  • [info]

    OCR (chs) started (146.5 KB)
    
  • [info]

    OCR result received (1.7s from XModule OCR)
    
  • [info]

    OCR (chs) started (7.1 KB)
    
  • [info]

    OCR result received (0.8s from XModule OCR)
    
  • [info]

    Executing:  | echo | ${extractresult} | blue | 
    
  • [echo]

    e one,• said Trump on Truth Sccial.
    
    
  • [info]

    Executing:  | executeScript |  |  | 
    
  • [info]

    Macro completed (Runtime 41.15s)
    

I created a short test macro and it works fine. The x/y values stored in the variables are not overwritten:

{
  "Name": "ocrtest",
  "CreationDate": "2025-10-21",
  "Commands": [
    {
      "Command": "store",
      "Target": "99",
      "Value": " !OCREngine",
      "Description": ""
    },
    {
      "Command": "open",
      "Target": "https://www.wikipedia.org/",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XMoveText",
      "Target": "Deutsch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!ocrx}",
      "Value": "x1",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!ocry}",
      "Value": "y1",
      "Description": ""
    },
    {
      "Command": "XMoveText",
      "Target": "English",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!ocrx}",
      "Value": "x2",
      "Description": ""
    },
    {
      "Command": "store",
      "Target": "${!ocry}",
      "Value": "y2",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "Deutsch center is at ${x1}, ${y1}",
      "Value": "green",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "English center is at ${x2}, ${y2}",
      "Value": "blue",
      "Description": ""
    },
    {
      "Command": "echo",
      "Target": "As test, lets click on Deutsch",
      "Value": "",
      "Description": ""
    },
    {
      "Command": "XClick",
      "Target": " ${x1}, ${y1}",
      "Value": "",
      "Description": "clicks on first OCR result word center"
    }
  ]
}

Yes, thank you. However, if you click the previous position using the stored variable, the command echo {!ocrx},${!ocry} displays the latest position instead of the clicked position.

Please refer to the log below based on your code with the newly added echo command in the last line.


  • [status]

    Playing macro 6_temp
    
  • [info]

    Executing:  | store | 99 |  !OCREngine | 
    
  • [info]

    Executing:  | open | https://www.wikipedia.org/ |  | 
    
  • [info]

    Executing:  | XMoveText | Deutsch |  | 
    
  • [info]

    OCR (chs) started (90.1 KB)
    
  • [info]

    OCR result received (1.5s from XModule OCR)
    
  • [info]

    Executing:  | store | ${!ocrx} | x1 | 
    
  • [info]

    Executing:  | store | ${!ocry} | y1 | 
    
  • [info]

    Executing:  | XMoveText | English |  | 
    
  • [info]

    OCR (chs) started (90.1 KB)
    
  • [info]

    OCR result received (1.2s from XModule OCR)
    
  • [info]

    Executing:  | store | ${!ocrx} | x2 | 
    
  • [info]

    Executing:  | store | ${!ocry} | y2 | 
    
  • [info]

    Executing:  | echo | Deutsch center is at ${x1}, ${y1} | green | 
    
  • [echo]

    Deutsch center is at 474, 279.5
    
  • [info]

    Executing:  | echo | English center is at ${x2}, ${y2} | blue | 
    
  • [echo]

    English center is at 804.5, 151.5
    
  • [info]

    Executing:  | echo | As test, lets click on Deutsch |  | 
    
  • [echo]

    As test, lets click on Deutsch
    
  • [info]

    Executing:  | XClick |  ${x1}, ${y1} |  | 
    
  • [info]

    Executing:  | echo | ${!ocrx},${!ocry} | green | 
    
  • [echo]

    804.5,151.5
    
  • [info]

    Macro completed (Runtime 17.56s)