Click 10 pixels below original click location

I'm trying to build a macro which:

  1. Auto clicks a specific location (via Move and Click action)

  2. Stores mouse X location (in a variable called Mouse_Location_X)

  3. Stores mouse Y location (in a variable called Mouse_Location_Y)

  4. Does a series of actions, etc.

  5. Adds 10 px to variable Mouse_Location_Y (by using a Set Variable to Calculation. In this case Mouse_Location_Y + 10)

  6. Sets mouse location X (via a Use Variable Mouse_Location_X to set Mouse Location)

  7. Sets mouse location Y (via a Use Variable Mouse_Location_Y to set Mouse Location)

For some reason both steps 6 and 7 above keep failing and I can't even read the entire error in the notification as it's truncated.

WHAT I'M TRYING TO ACCOMPLISH: I simply need the macro to click 10 pixels below the original auto-click location (step 1 above).

I've attached my macro:
click 10 px below original click location2.kmmacros (34.2 KB)

Any clarification is appreciated. Thanks!

I had a quick look in it as I was curious what you use a "click 10px below action" for.

I think I saw the mistake. "Use variable to set mouse location" expects 2 parameters (separated with a comma). Never used this action before but I felt it looks odd that you have this twice, as how would Keyboard Maestro know which one is the x and which is the y position?

Just make one var Mouse_Location and set to
%Calculate%MOUSEX()%, %Calculate%MOUSEY()%
then pass it just once in use-variable as you done before.

hope this helps
regards Julian

If you are not going to manually move the mouse during the macro (like with the Prompt for User Input), then all you need is very simple.

You don't need to record and increment the mouse position manually since both of the Move and Click Actions will move the mouse for you.
So, in the Move and Click Action in the Repeat loop, all you need is the 10pxl increment in the Action.

MACRO:   Create layer comps -- @JMichaelTX Simplified

~~~ VER: 1.0    2019-05-30 ~~~

DOWNLOAD:

Create layer comps -- @JMichaelTX Simplified.kmmacros (31 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


image

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Questions?

1 Like

And alternatively, given variables Mouse_Location_X and Mouse_Location_Y you can move the mouse using the Move Mouse action, move it relative to absolute coordinates and use “Mouse_Location_X” and “Mouse_Location_Y” (or “Mouse_Location_Y + 10”) as the location.

Yes, but then you would also have to reset the variables “Mouse_Location_X” and “Mouse_Location_Y” after each move.

If for some reason you needed the mouse location in a KM variable, it would be much simpler to just use the token:

image

And then use Mouse_Location.X and Mouse_Location.Y when/if you needed them.