User Tools

Site Tools


token:WindowName

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
token:WindowName [2016/11/22 21:11]
peternlewis [WindowFrame (FrontWindowFrame)]
token:WindowName [2016/12/03 12:20]
JMichaelTX [WindowName and FrontWindowName Tokens]
Line 1: Line 1:
 {{:​action:​window-icon.png?​nolink|}} {{:​action:​window-icon.png?​nolink|}}
-====== ​Windows Related ​Tokens ======+====== ​WindowName and FrontWindowName ​Tokens ======
  
 This Wiki page receives the redirect for a number or windows related tokens: This Wiki page receives the redirect for a number or windows related tokens:
- 
-  * [[token:​WindowFrame|%WindowFrame%]] 
-  * [[token:​WindowPosition|%WindowPosition%]] 
-  * [[token:​WindowSize|%WindowSize%]] 
   * [[token:​WindowName|%WindowName%]] ​   * [[token:​WindowName|%WindowName%]] ​
 +  * [[token:​FrontWindowName|%FrontWindowName%]] ​
  
- +Each of these text tokens return ​the name of the specified window.  ​
-Each of these text tokens return ​information about the specified window.  ​+
  
  
Line 16: Line 12:
  
  
-Each one takes a parameter indicating which window to use.  The parameter is the value _after_ the percent sign of the main token.\\ +The //​WindowName//​ token takes a parameter indicating which window to use.  The parameter is the value _after_ the percent sign of the main token. For example: `% WindowName%1%`
-For example:\\ +
-`%TokenName%TokenParameter%`\\ +
-`%WindowFrame%1%`+
  
 The parameter may be: The parameter may be:
Line 29: Line 22:
 So for example, //​%WindowName%1%//​ gives the name of the front window. 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). +`%FrontWindowName%` is a synonym for `%WindowName%Front%` and may be used interchangeably.
- +
-==== WindowFrame (FrontWindowFrame) ==== +
- +
- +
-The `%WindowFrame%` 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. +
- +
-`%FrontWindowFrame%` is a synonym for `%WindowFrame%1%` 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 [[token:​Calculate|Calculate Token]], such as the following:​ +
- +
-{{:​token:​km-7.3-window-coordinates.png?​nolink|}} +
- +
-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 ===== ===== See Also =====
Line 98: Line 39:
  
 * [[token:​FrontWindowFrame|%FrontWindowFrame%]] * [[token:​FrontWindowFrame|%FrontWindowFrame%]]
-* [[token:​FrontWindowName|%FrontWindowName%]] 
 * [[token:​FrontWindowPosition|%FrontWindowPosition%]] * [[token:​FrontWindowPosition|%FrontWindowPosition%]]
 * [[token:​FrontWindowSize|%FrontWindowSize%]] * [[token:​FrontWindowSize|%FrontWindowSize%]]
token/WindowName.txt · Last modified: 2019/07/05 03:45 by peternlewis