Can I get the current mouse position?
-
jupe
- Posts: 3478
- Joined: 20 Oct 2017 21:14
- Location: Win10 22H2 120dpi
Re: Can I get the current mouse position?
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:
eg. Ouput :
GetCursorPos = 882, 536
Code: Select all
::screen;GetCursorPos = 882, 536
-
kuiwu_cn
Re: Can I get the current mouse position?
Can the return string be written to a variable?
-
highend
- Posts: 15004
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Can I get the current mouse position?
Not with that screen command.
You could use something like this instead:
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";
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal
-
admin
- Site Admin
- Posts: 66719
- Joined: 22 May 2004 16:48
- Location: Win8.1, Win10, Win11, all @100%
- Contact:
Re: Can I get the current mouse position?
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
FAQ | XY News RSS | XY X
XYplorer Beta Club