Window.GetLeft
--------------

Queries X coordinate of a window.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Window](component_Window.md) | [2.8](newinversion28.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Window.GetLeft"; WindowRef ) 

**MBS**( **"Window.GetLeft";** /\* Queries X coordinate of a window. \*/  
**$WindowRef**) /\* Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| WindowRef | Window Reference is the unique OS level window ID. You can obtain this by using the [Window.FindByTitle](WindowFindByTitle.md) or [Window.FindByIndex](WindowFindByIndex.md) functions. Pass zero to access the frontmost window. | 0 |

### Result

Returns number or error.

### Description

Queries X coordinate of a window.  
See also [Window.GetTop](WindowGetTop.md), [Window.GetWidth](WindowGetWidth.md) and [Window.GetHeight](WindowGetHeight.md).  
### Examples

Get position of front window:

 MBS ( "Window.GetLeft"; 0 ) &amp; "/" &amp; MBS ( "[Window.GetTop](WindowGetTop.md)"; 0 )  
Figure out on which screen the first window is:

 Let(\[  
 WindowCenterX = MBS ( "Window.GetLeft"; 0 ) + MBS ( "[Window.GetWidth](WindowGetWidth.md)"; 0 );  
 WindowCenterY = MBS ( "[Window.GetTop](WindowGetTop.md)"; 0 ) + MBS ( "[Window.GetHeight](WindowGetHeight.md)"; 0 );  
 $ScreenIndex = -1;  
  
 r = While (   
 \[   
 c = MBS ( "[Screen.Count](ScreenCount.md)" );   
 i = 0   
 \] ;   
 i &lt; c ;   
 \[   
 l = MBS ( "[Screen.Left](ScreenLeft.md)"; i );  
 t = MBS ( "[Screen.Top](ScreenTop.md)"; i );  
 w = MBS ( "[Screen.Width](ScreenWidth.md)"; i );  
 h = MBS ( "[Screen.Height](ScreenHeight.md)"; i );  
 $ScreenIndex = If(   
 (l ≤ WindowCenterX) AND   
 (t ≤ WindowCenterY) AND   
 (WindowCenterX ≤ l + w) AND   
 (WindowCenterY ≤ t + h) ; i; $ScreenIndex );   
 i = i + 1 \] ; 0 )  
  
\]; $ScreenIndex )  
### See also

- [Dialog.GetLeft](DialogGetLeft.md)
- [Screen.Count](ScreenCount.md)
- [Screen.Height](ScreenHeight.md)
- [Screen.Left](ScreenLeft.md)
- [Screen.Width](ScreenWidth.md)
- [Window.FindByIndex](WindowFindByIndex.md)
- [Window.FindByTitle](WindowFindByTitle.md)
- [Window.GetHeight](WindowGetHeight.md)
- [Window.GetTop](WindowGetTop.md)
- [Window.GetWidth](WindowGetWidth.md)

### Example Databases

- [RemoteControl/Windows List](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/RemoteControl/Windows%20List.shtml#1ScriptAnchor_)
- [Window/Schedule Moved Trigger](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/Schedule%20Moved%20Trigger.shtml#1ScriptAnchor_)
- [Window/Window Position and Size](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Window/Window%20Position%20and%20Size.shtml#1ScriptAnchor_)

### Blog Entries

- [Script trigger for moving window](https://www.mbsplugins.de/archive/2022-10-07/Script_trigger_for_moving_wind/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 4/2025, Seite 29](https://filemaker-magazin.de/neuigkeit/4297-Appetithappen-FMM_202504)

This function checks for a license.

Created 18th August 2014 , last changed 24th January 2024

  
[Window.GetHeight](WindowGetHeight.md) - [Window.GetMaxHeight](WindowGetMaxHeight.md)

[HTML Version](WindowGetLeft.shtml)