How to parse a screen coordinates into unique variables

For example after running find image on screen I would have a variable as follows 1367,627,175,44,0 how can I parse that variable into 5 unique variables?

I.E.
x=1367
y=627
xDistance=175
yDistance=44
display=0

That link you included tells you sort-of how to do it. Reference that link, and then this:

image

It doesn't tell you which display - you'll have to figure that out from the coordinates.

Hope this helps.

You can also try the following example which will tell you the display number: examples.kmmacros (1.7 KB)

As the post by @DanThomas showed, you don't really need to parse the image coordinates since the individual coordinates, and some computed one, will always be available using the dot notation. See FoundImage Token .

If you have stored the image coordinates in the KM Variable "ImageLoc", you can access the individual coordinate like this:
<KM Variable Name>.<Coordinate Property>
ImageLoc.MidX

FoundImage Coordinate Properties

  • ImageLoc.x — Horizontal position of upper left corner.
  • ImageLoc.y — Vertical position of upper left corner.
  • ImageLoc.width — the Width of the match (same as the source image).
  • ImageLoc.height — the Height of the match (same as the source image).
  • ImageLoc.fuzz — the Fuzz of the match.
  • ImageLoc.Midx — Horizontal position of center.
  • ImageLoc.Midy — Vertical position of center.

If the KM Variable is a Global Variable, like the one I show above, then that variable will persist across Macros and even Mac restarts, and you will be able to refer to individual coordinates at any time in the future.

BTW, you can also use this notation in calculations.