Mouse increment action loop

I want to add an increment into mouse coordinate each time the loop is running. Like if current mouse click is at (900,300) then on next loop, it should click at (900,400) and next click will be at (900,500)
{increment of 100 in y coordinate}

Use the Set Variable to Calculation action, eg:

image

But how Can I take input from user? like if user says repeat (3 times) then index value should be start from 300, then it will be 400 then it will be 500.
Please make an example macro, if you can.

Use the Prompt for User Input action to ask for the starting value.

I did that, but you see. I have to provide default index value = 300 (that should't be user defined as it will always starts with 300 , and then I had added "index + 100" for increment)

if user says repeat (3 times) then index value should be start from 300, then it will be 400 then it will be 500.
But how Can I set default value of index = 300 without taking input from user?
Please take a look at this macro below.
mouse increment.kmmacros (3.5 KB)

I'm confused. When do you want to ask the user, and when do you want to use a default value?

I will create 2 separate macros. 1 is for user input, like how many times user want to repeat the macro " mouse increment.kmmacros " ?
2nd is the one that I have attached above named " mouse increment.kmmacros "
but in 2nd macro how Can I set default value of index = 300 without taking input from user?

OK, so the first one uses the Prompt for User Input action to specify the starting value of Index and/or the number of times to repeat in another variable, say Count.

image

Then the second macro uses the Index and/or Count variables. Keyboard Maestro global variables retain their value until they are changed.

image

But I don't want user to add value of " index ", I want to predefine the index = 300 at starting.

Here's a really long-winded version so you can see what's going on. It doesn't move the mouse -- you can use @peternlewis's steps above for that -- but shows the value increasing every loop using OS notifications:


Increment User-Defined Times.kmmacros (5.2 KB)

1 Like

Oddly enough, I made a similar macro just yesterday for someone. Perhaps it might be of interest to you.

1 Like