Screenshot
----------

Takes a screenshot of the screen indicated by the "ScreenID" parameter.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Screenshot](component_Screenshot.md) | [1.0](newinversion10.md) | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No |

MBS( "Screenshot"; ScreenID; Format; Quality; FileName ) 

**MBS**( **"Screenshot";** /\* Takes a screenshot of the screen indicated by the "ScreenID" parameter. \*/  
**$ScreenID**; /\* Zero Based index of the screens.   
If blank, then 0 is assumed.  
Use in range from 0 to MBS( "[Screen.Count](ScreenCount.md)" )-1.e.g. 0 \*/   
**$Format**; /\* The format of the file (currently only JPEG is supported)e.g. JPEG \*/   
**$Quality**; /\* The quality of the image. From 0 to 100.e.g. 80 \*/   
**$FileName**) /\* The desired file name.  
The image is not written to disk. This file name is just added to the container for later export.e.g. MyCoolFile \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ScreenID | Zero Based index of the screens.    If blank, then 0 is assumed.   Use in range from 0 to MBS( "[Screen.Count](ScreenCount.md)" )-1. | 0 |
| Format | The format of the file (currently only JPEG is supported) | JPEG |
| Quality | The quality of the image. From 0 to 100. | 80 |
| FileName | The desired file name.   The image is not written to disk. This file name is just added to the container for later export. | MyCoolFile |

### Result

Returns the image as a container value so you can assign it to a container.

### Description

Takes a screenshot of the screen indicated by the "ScreenID" parameter.  
Use "Set Field" to set the result of this function into any container field.   
Updated for macOS 10.7 in plugin version 2.5.  
  
Returns the image as container value, so you can assign it to a container field or save to disk with [Container.WriteFile](ContainerWriteFile.md) function.  
Added multi screen support for Windows with v11.3.  
  
See also [Container.Screenshot](ContainerScreenshot.md) to make screenshot of a layout object, [WebView.Screenshot](WebViewScreenshot.md) to make a screenshot of a web viewer and [Window.Screenshot](WindowScreenshot.md) for a screenshot of a window.  
### Examples

Capture screen as JPEG:

 Let(  
\[  
/\*-----------------PARAMETERS--------------------\*/   
ScreenID = 0;  
Format = "JPEG";  
Quality = 90;  
Filename = "MyCoolFile"  
\];  
/\*-------------------FUNCTION----------------------\*/   
MBS (   
"Screenshot";  
ScreenID ;  
Format ;  
Quality ;  
Filename   
)  
)  
Put screenshot in field:

 Set Variable \[ $screenshot ; Value: MBS ("Screenshot"; 0; "jpeg"; 90) \]   
Set Field \[ Contacts::Photo Container ; $screenshot \]  
Get screenshot of second screen:

 Set Field \[ Contacts::Photo Container ; MBS ("Screenshot"; 1) \]  
### See also

- [Container.Screenshot](ContainerScreenshot.md)
- [Container.WriteFile](ContainerWriteFile.md)
- [Screen.Count](ScreenCount.md)
- [WebView.Screenshot](WebViewScreenshot.md)
- [Window.Screen](WindowScreen.md)
- [Window.Screenshot](WindowScreenshot.md)

This function checks for a license.

Created 18th August 2014 , last changed 18th April 2022

  
[Screen.Width](ScreenWidth.md) - [ScreenshotRect](ScreenshotRect.md)

[HTML Version](Screenshot.shtml)