Can I get the current mouse position?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
kuiwu_cn

Can I get the current mouse position?

Post by kuiwu_cn »

Can I get the current mouse position?

jupe
Posts: 2788
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Can I get the current mouse position?

Post by jupe »

This probably isn't going to help you, it depends on what you want the coordinates for, but you can run the following and get info on mouse coordinates in a popup window:

Code: Select all

::screen;
eg. Ouput :

GetCursorPos = 882, 536

kuiwu_cn

Re: Can I get the current mouse position?

Post by kuiwu_cn »

Thank you very much.

kuiwu_cn

Re: Can I get the current mouse position?

Post by kuiwu_cn »

Can the return string be written to a variable?

highend
Posts: 13309
Joined: 06 Feb 2011 00:33

Re: Can I get the current mouse position?

Post by highend »

Not with that screen command.

You could use something like this instead:

Code: Select all

    $clip = <clipboard>;
    run "<path to get mouse position.exe>", "%TEMP%", 2, 0;
    $x = gettoken(<clipboard>, 1);
    $y = gettoken(<clipboard>, 2);
    copytext $clip;
    status "X: $x, Y: $y";
Get mouse position.zip
(1.93 KiB) Downloaded 51 times
One of my scripts helped you out? Please donate via Paypal

kuiwu_cn

Re: Can I get the current mouse position?

Post by kuiwu_cn »

Thank you very much.

admin
Site Admin
Posts: 60530
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Can I get the current mouse position?

Post by admin »

Next version it will be a little more comfortable:

Code: Select all

    + SC get got a new named argument "cursorpos" to return the mouse cursor 
      position on screen.
      Syntax: get("cursorpos", param1)
        param1:
          x,X: X position
          y,Y: Y position
          [else]: Separator between X and Y position
                  If empty it defaults to ";"
        return: Mouse cursor position on screen.
      Examples:
        echo get("cursorpos");      //425;237
        echo get("cursorpos", ","); //339,488
        echo get("cursorpos", ", "); //339, 488
        echo get("cursorpos", "X"); //1018
        echo get("cursorpos", "y"); //414        

Post Reply