Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is there a program which lets you easily get the x,y coordinates for your cursor?

Basically, I move my cursor to somewhere on my screen, it shows me the x,y coordinates and has an option to copy them to the clipboard or export them somehow.

I can already do this if I take a screenshot and open it in MS Paint, then as I move the mouse cursor over the screenshot it shows the coordinates in the status bar, however I have to manually write them down, hence its not convenient.

share|improve this question
    
You might clarify this by specifying OS, and do you mean terminal coordinates, or GUI coordinates, and whether relative to window or screen. But, most GUI test recording tools can do that. –  Keith Feb 10 '11 at 22:45
    
@Keith I'm on windows XP, and I'm not sure what the difference is –  Click Upvote Feb 10 '11 at 22:46
    
You may also want to look at this. –  muntoo Feb 11 '11 at 6:06
    
See also Utilities for finding x/y screen coordinates with 6 answers, some for Windows. –  slothbear Dec 25 '12 at 4:45

1 Answer 1

up vote 2 down vote accepted

Pegtop's PMeter can do this.

It also has a ruler and a color picker:

(here be screenshots)


Programmatically, this is done using GetCursorPos() Win32 API, or Control.MousePosition in .NET.

In other words, it's do-it-yourself time. Copy this to MousePos.cs:

using System;
using System.Drawing;
using System.Windows.Forms;

class Coords {
    [STAThread]
    static void Main(string[] args) {
        bool copy = (args.Length == 1 && String.Compare(args[0], "/c") == 0);
        Point point = Control.MousePosition;
        string pos = String.Format("{0}x{1}", point.X, point.Y);
        if (copy) {
            Clipboard.SetText(pos);
        } else {
            Console.WriteLine(pos);
        }           
    }
}

If you have .NET Framework, compile with:

csc MousePos.cs /r:System.dll /r:System.Windows.Forms.dll /r:System.Drawing.dll

Copy to clipboard:

mousepos /c

The C# compiler, csc.exe, can be found in C:\Windows\Microsoft.NET\Framework\v3.5 (the version may vary; you can use whichever you have).

share|improve this answer
    
It only seems to show the coordinates, but doesn't have any way to copy them? I'd like something that can copy the coordinates –  Click Upvote Feb 10 '11 at 22:56
    
Wow that picture is really confusing... for lesser mortals. Someone else told me it was (they are a "Lesser Mortal"), so I assume it should be (for them). –  muntoo Feb 11 '11 at 6:04
    
@Click: See update. –  grawity Feb 11 '11 at 6:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.