Automator_Enthusiast
Automator_Enthusiast

Reputation: 131

AHK - mouseclick coordinates relative to app window

I was reading through AHK documentation but couldn't find one where it explains how to define the coordinates WITHIN a certain application window.

For example, I want to be able to minimize/maximize the ribbon in all microsoft office apps (top right corner). This should work reliably no matter whether the window is maximized or not, and the mouse cursor should not shift (or at least it should shift back) while doing so.

Any idea how i can achieve this?

Upvotes: 3

Views: 5439

Answers (1)

Elliot DeNolf
Elliot DeNolf

Reputation: 2999

If you want coordinates to be relative to the active window, you need to use the CoordMode command at the top of your script. The second parameter specifies the coordinate mode will be for mouse coordinates. The third parameter you can specify either Screen or Relative. Relative is what you are looking for.

CoordMode, Mouse, Relative

Upvotes: 4

Related Questions