Find the Mouse Cursor with Keyboard Maestro

I use this macro to quickly center my mouse cursor on my main screen. I have two large monitors and embarrassingly, I lose my mouse cursor occasionally.

This macro is also a good demonstration of some of the calculations with Keyboard Maestro variables.

The macro is triggered by the option-shift left click-release mouse action. It simply moves the mouse to the exact center of the primary monitor.

I take advantage of some of the built in KM tokens in this macro. For example the %Screen%Main% variable extracts the frame of the primary monitor.

Next, I use the Move Mouse action. Instead of hard coding in the location I want the cursor moved to, I use the array values that represent the frame of the screen. KM list values are accessed as if they were arrays (starting at 1). In this case, temp[3] points to the value 2560. But since the Move Mouse action accepts a numerical value, I can actually use some basic math functions to generate the value. This is true of any action that uses a numerical value. They can all accept a calculations instead. Nifty.

UPDATE: I changed the trigger to be more compatible with applications that respond to cmd-click.