11

I have an application that needs the user to enter the x and y location of a couple of items on the screen. [Yes, this is crap and I'll replace it, but for now...]

On Mac OS X, I'm using Snapz Pro X. When I choose to take a snap of a selection, the interface displays the mouse cursor location. This is OK for my personal use, but I can't ask users to buy a $69 program for this function.

I thought I had a solution with the built-in program "Grab", but it reports the coordinates from the bottom left, and I need it from the top left.

I don't have access to Windows; not sure what to use there. I've not even been able to come up with good search terms since mouse and coordinates and x/y are so common. Ideas are welcome there. Extra credit: same x/y finder for Linux. A Java program would be OK too, since the main application is in Java.

5
  • ACK! I've asked 4 questions in 1 (platform.each). But it would have seemed dumb to ask a separate question for each platform. Hm.
    – slothbear
    Dec 21, 2009 at 5:05
  • The answers you folks posted helped me refine my search terms -- so I was able to find some more answers. Much appreciated!
    – slothbear
    Dec 24, 2009 at 4:02
  • Uhm. Snapz Pro X has a 15-day free trial. After that, it watermarks the screen captures. And you don't even want the actual screen capture. Unless you think that's abusing the free trial. It's a great program; maybe they'll get hooked and buy it.
    – slothbear
    Dec 24, 2009 at 4:09
  • I might as well be my own sock puppet at this point.
    – slothbear
    Dec 24, 2009 at 4:09
  • See also Program for getting the cursor's x,y coordinates? with another suggestion for Windows.
    – slothbear
    Dec 25, 2012 at 4:45

16 Answers 16

7

Warning : This is an old post. This product is no longer available.

For Windows you can use Point Position :

The way to use the application is very simple:

  • Move the window by putting your mouse cursor in the cross which is in the middle of it, and point one of the four corner arrows into the place of the screen you want to define.
  • Then push the button corresponding to the pointing arrow.
  • The text entries will take the color of the button, and they will show you the exact pointing position.

image

5
  • feel free to upvote my recommendation :)
    – Molly7244
    Dec 20, 2009 at 21:19
  • I'll just upvote both of you, though merging answers like this would be better!
    – Ivo Flipse
    Dec 21, 2009 at 12:07
  • Dead link. :( .
    – Almo
    Sep 30, 2023 at 3:49
  • 1
    @Almo: This answer is from 2009 and this product has disappeared since many years. I added a warning.
    – harrymc
    Sep 30, 2023 at 8:11
  • Thanks! @harrymc :)
    – Almo
    Oct 4, 2023 at 19:44
5

Point Position (for Windows) is a simple tool that lets you pick the coordinates for any point on your screen (using X,Y axis). Simply point one of the four corner arrows at the spot on your screen that you want to define and click the button to display the X/Y coordinates.

Point Position is freeware.

6
  • Upvote done. Isn't my recommendation beautiful, image and all? Would be a great pity to delete it :)
    – harrymc
    Dec 20, 2009 at 21:35
  • I'll just upvote both of you, though merging answers like this would be better!
    – Ivo Flipse
    Dec 21, 2009 at 12:06
  • @Ivo: No problem. We also upvoted each other.
    – harrymc
    Dec 21, 2009 at 12:42
  • @Molly: It seems like the image carried the day. My apologies.
    – harrymc
    Dec 23, 2009 at 14:25
  • 2
    "Sorry! This program is no longer available for download from our site. It may have been discontinued or become obsolete."
    – AXO
    Dec 4, 2015 at 1:13
4

For windows, you can use a powershell script with System.Windows.Forms.Cursor

e.g.

Add-Type -AssemblyName System.Windows.Forms
while (1) {
    $X = [System.Windows.Forms.Cursor]::Position.X
    $Y = [System.Windows.Forms.Cursor]::Position.Y

    Write-Host -NoNewline "`rX: $X | Y: $Y"
}

(copied and modified from https://norbertvajda.wordpress.com/2018/12/29/get-the-cursor-position-with-powershell/)

1
  • Opted not to improve this base version in case someone writes a better version of the overwrite function: mine works but suffers from a bit of stutter superuser.com/a/1731782/139701
    – smaudet
    Jul 15, 2022 at 8:00
3

For Macintosh, use the built-in screen capture function. Press Command-Shift-4 to take a picture of part of the screen. The cursor switches to a crosshairs cursor that includes the x/y screen coordinates. Press ESC to cancel the operation

1
  • 1
    That works, but it's kind of tough to use in practice. The screen continues to update under the cursor (popups and junk in this case), plus the x/y numbers have poor contrasting colors and they're tiny. It sounds better to use the Grab program -- and teach them how to subtract the Y value from their screen height. You already have an ugly UI, what's one subtraction?
    – slothbear
    Dec 24, 2009 at 4:12
3

I was led to this page through a query of my own. I had a further search around and found xev (on Linux and Mac OS X.)

Here's the Mac OS X documentation: http://developer.apple.com/Mac/library/documentation/Darwin/Reference/ManPages/man1/xev.1.html

The Bash commands

$ root=`xwininfo -root | grep xwininfo | sed 's/.*0x/0x/; s/ .*//'`

$ xev -id $root

provided me with the information required. :)

1
  • It is important to know that on OS X, the xev command requires installation of X11. This is an optional installation on later OS X systems.
    – slothbear
    Dec 25, 2012 at 4:41
3
$lastX = ""
$lastY = ""
Clear-Host
while (1) {
    $X = [System.Windows.Forms.Cursor]::Position.X
    $Y = [System.Windows.Forms.Cursor]::Position.Y
    if(($lastX -ne $X -or $lastY -ne $Y)) {
        Write-Host -NoNewline "                           " 
        $lastX = $X
        $lastY = $Y
    }
    Write-Host -NoNewline "`rX: $X | Y: $Y"
}

Based on the answer by JamesG3D, fixed it so it doesn't leave extraneous characters on-screen.

2

I used Cursor Position from CNET.com:

From Mattlav Software: Cursor Position allows you to work out the exact X and Y position of your cursor even as you move it, it also tells you how many pixels you have gone across if you move the cursor with the application open.

5
  • Can you provide some details as to how the application solves the question? thanks.
    – suspectus
    Aug 26, 2015 at 7:27
  • I edited the question
    – user470881
    Aug 26, 2015 at 8:10
  • That looks much better now.
    – suspectus
    Aug 26, 2015 at 8:32
  • Nice app! Runs on Windows (not a dig, just noting since I included all platforms in the question).
    – slothbear
    Aug 26, 2015 at 15:21
  • Looks like this link is broken now May 5, 2022 at 17:05
1

For Mac OS X, xScope is pretty good. Turn on the Loupe (magnify) tool to make it easier to see exactly where you are. Then use the Crosshair tool to locate the exact spot you need.

If you'd like to measure your spot from a place that is not relative to the screen origin, move the cursor to your local 0,0, then press Command-0 to set that spot as 0,0.

xScope is a commercial product from The iconfactory. The app shows up in bundles regularly. But it must be worthwhile. Heck, the latest version boasts

70+ new features

1
  • Sockpuppet!!!!!
    – slothbear
    Jan 9, 2014 at 0:34
1

As of this writing (2022), the links were dead for both Point Position and Cursor Position, but I found a similar program called MPos on SourceForge. Just run the executable and you get a draggable display showing the current mouse coordinates.

1
  • Fair warning the code in question uses some questionable practices like code weaving (why?), for what should be a fairly simplistic, no-nonsense utility... It appears to be some bootstrap code for doing things like updates, but the code for these dependencies is not provided. I would approach with caution.
    – smaudet
    Jul 14, 2022 at 18:14
1

13 years later...

I found this thread searching for a quick solution to the same issue and wanted to share my own solution with you for desktop PC.

I took a screenshot (Fn + Prt Sc) and pasted that into Photoshop. I then used the Rectangular Marquee Tool to select the area that I needed the coordinates of and Photoshop gave me them on the right hand side of the screen.

Screen Coordinates Via Photoshop

1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Aug 23, 2023 at 8:47
1

you can use this from the pyautogui docs:

#! python3
import pyautogui, sys
print('Press Ctrl-C to quit.')
try:
    while True:
        x, y = pyautogui.position()
        positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
        print(positionStr, end='')
        print('\b' * len(positionStr), end='', flush=True)
except KeyboardInterrupt:
    print('\n')

python 2:

#! python
import pyautogui, sys
print('Press Ctrl-C to quit.')
try:
    while True:
        x, y = pyautogui.position()
        positionStr = 'X: ' + str(x).rjust(4) + ' Y: ' + str(y).rjust(4)
        print positionStr,
        print '\b' * (len(positionStr) + 2),
        sys.stdout.flush()
except KeyboardInterrupt:
    print '\n'
0

For Java, you can use the PointerInfo class, introduced in Java 1.5.

import java.awt.MouseInfo;
import java.awt.Point;

public class Portia {
     public static void main(String args[]) throws InterruptedException {
        Thread.sleep(10000);  // some time for user to position mouse
        Point spot = MouseInfo.getPointerInfo().getLocation();
        System.out.println(
                String.valueOf(spot.getX())
                +","+
                String.valueOf(spot.getY()));
     }
}
0

Skitch from Evernote includes an x/y coordinate display while taking a screen snap. The numbers are small and don't have any contrast layer -- so they're hard to see on a black background. Skitch is currently free.

enter image description here

1
0

Quix App is a browser bookmarklet: cross-platform, no plug-ins.

Drag the bookmarklet to your bookmarks toolbar. Click. Enter the command ruler, and you get a nice cross-hairs cursor to work with, and an informative pop-up with all the coordinates.

alt text

1
0

If you're using the Chrome browser, there is a well-maintained extension called coordinates. It shows coordinates for the page, the screen, and can measure an area by dragging.

0

The screen capture function from WeChat is also able to show the coordinates (X, Y)) and color (RGB) where your mouse cursor is.

This is what the output looks like:

Output

You must log in to answer this question.

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