mouseLocation
Returns the mouse pointer position as `x,y` text.
Keyboard Maestro: CurrentMouse
Details #
mouseLocation() takes no arguments and returns text like 640,412: the pointer's x and y, each rounded to a whole number, joined by a comma. Positions are in screen points with the origin at the top left of the main display, so a pointer on a second screen can have a negative x or a y beyond the main display's height.
Use mouseX or mouseY when you want one number to calculate with.
Parameters #
Takes 0 arguments.
{{ mouseLocation() }}
Examples #
mouseLocation()→
0,0length(mouseLocation()) > 2→
trueGotchas #
Calling it with an argument is an error:
mouseLocation() takes 0 arguments, got 1.The result is text, not a number. Split it or use
mouseX()andmouseY()for arithmetic.With nothing real to read, the position is
0,0.