Can I get the current mouse position?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
kuiwu_cn
Posts: 46
Joined: 16 Nov 2016 15:15

Can I get the current mouse position?

Postby kuiwu_cn » 13 Apr 2018 03:25

Can I get the current mouse position?

jupe
Posts: 684
Joined: 20 Oct 2017 21:14

Re: Can I get the current mouse position?

Postby jupe » 13 Apr 2018 03:36

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
Posts: 46
Joined: 16 Nov 2016 15:15

Re: Can I get the current mouse position?

Postby kuiwu_cn » 13 Apr 2018 03:42

Thank you very much.

kuiwu_cn
Posts: 46
Joined: 16 Nov 2016 15:15

Re: Can I get the current mouse position?

Postby kuiwu_cn » 13 Apr 2018 03:45

Can the return string be written to a variable?

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

Re: Can I get the current mouse position?

Postby highend » 13 Apr 2018 06:02

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 7 times
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

kuiwu_cn
Posts: 46
Joined: 16 Nov 2016 15:15

Re: Can I get the current mouse position?

Postby kuiwu_cn » 13 Apr 2018 06:32

Thank you very much.

admin
Site Admin
Posts: 44484
Joined: 22 May 2004 16:48
Location: Cologne, Win 8.1, Win 10
Contact:

Re: Can I get the current mouse position?

Postby admin » 19 Apr 2018 14:56

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       


Return to “Tips & Tricks, Questions & Answers”



Who is online

Users browsing this forum: No registered users and 5 guests