This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
function:SCREEN [2017/04/26 23:28] JMichaelTX Clarify Screen indexes, and convert to table. |
function:SCREEN [2023/02/17 01:56] peternlewis |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | The [[function:SCREEN|SCREEN()]] and [[function:SCREENVISIBLE|SCREENVISIBLE()]] functions return the position or size of a screen. [[function:SCREENVISIBLE|SCREENVISIBLE()]] refers to the visible section of the screen, excluding the menu bar and the dock. | + | ====== SCREEN, SCREENVISIBLE and SCREENINDEX Functions ====== |
- | SCREEN( index [number OR name], coordinate ) | + | The //SCREEN()// and //SCREENVISIBLE()// functions return the position or size of a screen. //SCREENVISIBLE()// refers to the visible section of the screen, excluding the menu bar and the dock. |
- | SCREEN( index [number OR name], coordinate, percentage ) | + | |
+ | The //SCREENINDEX()// function returns (v10.0+) the actual index of the specified screen, counting from left to right. | ||
+ | |||
+ | ``` | ||
+ | SCREEN( index [number OR name], coordinate ) | ||
+ | SCREEN( index [number OR name], coordinate, percentage ) | ||
+ | ``` | ||
The SCREEN *index* can be referenced by either a _number_ OR a _name_. The _Index number_ can be 0 for the main screen, and then 1 through n are the screens in orientation order from left to right (and top down for screens at the same position). _Index Names_ are shown below. | The SCREEN *index* can be referenced by either a _number_ OR a _name_. The _Index number_ can be 0 for the main screen, and then 1 through n are the screens in orientation order from left to right (and top down for screens at the same position). _Index Names_ are shown below. | ||
The _Main_ screen is set by your macOS System Preferences. | The _Main_ screen is set by your macOS System Preferences. | ||
+ | |||
The other screens (monitors) are referenced positionally from the left most screen, which may, or _may not_, be the _Main_ screen. | The other screens (monitors) are referenced positionally from the left most screen, which may, or _may not_, be the _Main_ screen. | ||
- | ^ Index Name ^ Index Number ^ Description ^ | + | ^ Index Name ^ Description ^ |
- | | **Main** | the screen with the primary menu bar (as configured in the Displays preferences).| | + | | Main or 0 | the screen with the primary menu bar (as configured in the Displays preferences).| |
| Second |the first from the left which is not the _Main_ screen.| | | Second |the first from the left which is not the _Main_ screen.| | ||
| Third | the second from the left which is not the _Main_ screen.| | | Third | the second from the left which is not the _Main_ screen.| | ||
Line 19: | Line 26: | ||
| Back | the first from the left not containing (the most of) the front window.| | | Back | the first from the left not containing (the most of) the front window.| | ||
| Back2 | the second left most screen not containing (the most of) the front window.| | | Back2 | the second left most screen not containing (the most of) the front window.| | ||
+ | | Positive Calculation | the indexed screen from left to right. | | ||
+ | | Negative Calculation | the indexed screen from right to left. | | ||
+ | | Variable Name | the index value based on the value of the variable (v9.0+). | | ||
- | :!: Note: Since the _Main_ screen can be in any position, be advised of the following: | + | :!: Note: Since the _Main_ screen can be in any position: |
* SCREEN(0) is always the _Main_ screen. | * SCREEN(0) is always the _Main_ screen. | ||
* SCREEN(1) may or may not be the _Main_ screen. | * SCREEN(1) may or may not be the _Main_ screen. | ||
* SCREEN(2+) may or may not be the _Main_ screen. | * SCREEN(2+) may or may not be the _Main_ screen. | ||
- | |||
The SCREEN *coordinate* can be: | The SCREEN *coordinate* can be: | ||
Line 36: | Line 45: | ||
* MidX | * MidX | ||
* MidY | * MidY | ||
+ | * Index (v9.0+) | ||
The optional SCREEN *percentage* parameter specifies a percentage of the width or height to offset by. Offsets are always to the right and down, but negative offsets are allowed. | The optional SCREEN *percentage* parameter specifies a percentage of the width or height to offset by. Offsets are always to the right and down, but negative offsets are allowed. | ||
Line 43: | Line 53: | ||
SCREEN sizes and positions are in //nominal resolution pixels// (so a retina screen will typically have half as many nominal resolution pixels as raw pixels). | SCREEN sizes and positions are in //nominal resolution pixels// (so a retina screen will typically have half as many nominal resolution pixels as raw pixels). | ||
- | Coordinates are in absolute coordinates (relative to the top left corner of the main screen). | + | Coordinates are in absolute nominal resolution pixels relative to the top left corner of the main screen. |
===== See Also ===== | ===== See Also ===== | ||
- | |||
- | ---- | ||
==== Actions ==== | ==== Actions ==== | ||
- | * [[action:Manipulate a Window|Manipulate a Window]] | + | * [[action:Manipulate a Window|Manipulate a Window]] action |
- | * [[action:Move or Click Mouse|Move or Click Mouse]] | + | * [[action:Move or Click Mouse|Move or Click Mouse]] action |
* [[:Actions|See all Actions]] | * [[:Actions|See all Actions]] | ||
==== Functions ==== | ==== Functions ==== | ||
- | * [[function:MENUBARHEIGHT|MENUBARHEIGHT()]] | + | * [[function:MENUBARHEIGHT|MENUBARHEIGHT()]] function |
- | * [[function:MOUSEBUTTON|MOUSEBUTTON()]] | + | * [[function:MOUSEBUTTON|MOUSEBUTTON()]] function |
- | * [[function:MOUSEX|MOUSEX()]] | + | * [[function:MOUSEX|MOUSEX()]] function |
- | * [[function:MOUSEY|MOUSEY()]] | + | * [[function:MOUSEY|MOUSEY()]] function |
- | * [[function:SCREENCOUNT|SCREENCOUNT()]] | + | * [[function:SCREENCOUNT|SCREENCOUNT()]] function |
- | * [[function:WINDOW|WINDOW()]] | + | * [[function:WINDOW|WINDOW()]] function |
- | * [[function:WINDOWCOUNT|WINDOWCOUNT()]] | + | * [[function:WINDOWCOUNT|WINDOWCOUNT()]] function |
* [[:Functions|See all Functions]] | * [[:Functions|See all Functions]] | ||
=== Tokens === | === Tokens === | ||
- | * [[token:Screen|%Screen%]] | + | * [[token:Screen|%Screen%]] token |
- | * [[token:ScreenVisible|%ScreenVisible%]] | + | * [[token:ScreenVisible|%ScreenVisible%]] token |
* [[:Tokens|See all Tokens]] | * [[:Tokens|See all Tokens]] | ||
- | |||
- | ---- | ||
==== Forum ==== | ==== Forum ==== | ||
- | - [[https://forum.keyboardmaestro.com/t/i-need-a-conditional-if-there-are-two-monitors/3031/5|I need a conditional if there are two monitors]] | + | - [[https://forum.keyboardmaestro.com/t/i-need-a-conditional-if-there-are-two-monitors/3031/|I need a conditional if there are two monitors]] |
- [[https://forum.keyboardmaestro.com/search?q=Screen|Keyboard Maestro Forum topics about Screen]] | - [[https://forum.keyboardmaestro.com/search?q=Screen|Keyboard Maestro Forum topics about Screen]] | ||