User Tools

Site Tools


token:WindowName

**This is an old revision of the document!**

Windows Related Tokens

This Wiki page receives the redirect for a number or windows related tokens:

Each of these text tokens return information about the specified window.

Token Parameters

Each one takes a parameter indicating which window to use. The parameter is the value after the percent sign of the main token.
For example:
%TokenName%TokenParameter%
%WindowFrame%1%

The parameter may be:

  • Front or 0: the focused/main window. Usually the same as index 1.
  • Positive Number: the indexed window from front to back.
  • Negative Number: the indexed window from back to front.

So for example, %WindowName%1% gives the name of the front window.

Like all coordinates in Keyboard Maestro, the WindowPosition and WindowFrame are from the top left corner of the main screen (the defined one with the menu bar on it, although this is less apparent now that the menu bar is on all monitors).

WindowFrame (FrontWindowFrame)

The %WindowFrame% and %FrontWindowFrame% tokens returns the location of the window in pixels of left, top, width, and height of the front window in a comma-delimited numerical string.

%WindowFrame%1% is synonymous and may be used interchangeably.

Example Return of these tokens:

228,23,1314,1173

left,top,width,height

Accessing Window and Screen Coordinates

When a Window or screen token returns a set of 4 comma-delimited values as one result into a Keyboard Maestro Variable (which is always text), you can access the individual values, and calculate other values, by using certain key words appended to the Variable name in a Calculate Token, such as the following:

This produces the following results, in the Display Action:

Window Frame:  2810,66,1281,1049

Left:	2810
Top:	66
Width:	1281
Height:	1049

Right:	4091
Bottom:	1115
MidX:	3450.5
MidY:	590.5

Screen/Window Keyword "coordinates"

  • Left
  • Right
  • Top
  • Bottom
  • Width
  • Height
  • MidX
  • MidY

See Also


Functions

Tokens

Triggers

Forum

token/WindowName.1479865423.txt.gz · Last modified: 2016/11/22 20:43 by JMichaelTX