(HELP) How to tell If the cusor in the current active App window?

I want to make a macro to judge if the mouse cursor in the current active App,

So , if the mouse Position is (x,y) and current active window position is (X,Y,W,H)

if(x>=X && x<= X+W && y<=Y && y<=Y-H) , the mouse cursor is in the current active app window,

I searched some token, but dont know how to compose those to a macro together,

Application: %Application%1%
Window Name: %WindowName%1%
Size (W,H): %WindowSize%1%
Position (→, ↓): %WindowPosition%1%

,I want to get the ''W' of window, and I try to use Calculate token,

// this not work
Size_W: %Calculate%WindowSize%1.width%

how to make this macro?

You're looking for the Window Frame token, which can provide all the values you need for a macro like this when assigned to a variable.

Example Macro.kmmacros (3.2 KB)


While I was typing my reply, it looks like @gglick jumped ahead and gave you the answer :slightly_smiling_face: But for completeness here is my reply anyway:

Have a look at this page:


Also, this Token gives you the Width of the Front Window in one step:


%FrontWindowFrame[1]% is left coordinate of top left of front window
%FrontWindowFrame[2]% is top coordinate of top left of front window
%FrontWindowFrame[3]% is width of front window
%FrontWindowFrame[4]% is height of front window