Clicks on specified positions

Hello, i like to play around with “If Then Else” macro. But now as beginner i have a problem - I don`t know how to set it up or if i can use this macro for my request -

The problem: If i Click on specified position in active window it would release click on different positition in another window. Both windows can be active (i mean visible on screen)

If i click on X,Y in active window it would click on X,Y in the second window.

I hope solution is simple, thank you!

You are confusing the If Then Else action with a trigger.

"if I do something" is a trigger, not an action. What you really mean there is "When I click", which makes it clearer that you are talking about a trigger, not an If Then Else action.

You can trigger on the mouse being clicking by using a USB Device Key trigger.

Then you would need to determine if the click was in the first window - this might be a use of the If Then Else action. You can get the window coordinates into a variable, and then use an If Then Else action, with a calculation along the lines of:

Frame.Left <= MOUSEX() & MOUSEX() <= Frame.Right & Frame.Top <= MOUSEY() & MOUSEY() <= Frame.bottom

Then you can use the offset of MOUSEX and MOUSEY from Frame.Left and Frame.Top to determine where in window 2 to click.

@Servok, while you can trigger on a mouse click, I would suggest that you try to find other events/actions to trigger on. Think about it, if a mouse click is a trigger, every time you click your mouse anywhere, which is probably very often, you will be triggering this macro.

Before you settle on mouse click as a trigger, take a look at all of the other triggers:
Triggers (KM Wiki).

For example, you can trigger on when the FrontMost window title changes, and put the macro in a group that is only active when a specific app is FrontMost. Then, if a window with a specific title is frontmost, you can check to see if the mouse is clicked at a point relative to the window boundaries, or if a particular button is present/clicked, or if a specific image is found. Many choices are available.

Perhaps if you can provide us with more details about your workflow, we can suggest some solutions.