SaveScreenShot
- Last UpdatedOct 29, 2026
- 3 minute read
SaveScreenShot is a built-in function that takes a screen shot of a project screen and then saves it as an image file.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
SaveScreenShot |
Graphic |
Synchronous |
No |
Supported |
Supported |
Not supported |
Supported (see Notes below) |
Not supported |
Syntax
SaveScreenShot(optStrScreenName,optStrOutputFile,optNumFormat)
optStrScreenName
The file path and name of a project screen file (*.scc or *.scr). If no file path is specified, the file must be located in the Screen sub-folder of the project folder. For example: AVEVA Edge 2026 Projects\<project name>\Screen\<screen name>.scr
Whether the screen must be open depends on where the function is executed. See Notes below.
This parameter is optional; if no value (or "") is specified, the currently open and active screen is used.
Note: Follow the conventions of the target platform for the file path and name, and separators. For example, a file path in Windows starts with a drive letter and uses backward slashes as separators (C:\path\to\file), while a file path in Linux starts at the root directory and uses forward slashes as separators (/path/to/file).
optStrOutputFile
The file path and name of the output file.
This parameter may be either optional or required, depending on where the function is executed. See Notes below.
optNumFormat
The format of the image file:
|
Value |
Description |
|---|---|
|
0 |
BMP |
|
1 |
JPG |
|
2 |
PNG |
|
3 |
GIF |
|
4 |
TIFF |
|
5 |
Auto |
This parameter is optional; if no value is specified, the default is 1 (JPG).
Return value
This function returns one of the following possible values:
|
Value |
Description |
|---|---|
|
0 |
Success. |
|
-1 |
Wrong number of parameters. |
|
-2 |
Wrong parameter types. |
|
-3 |
Invalid file path for optStrOutputFile. |
|
-4 |
optStrOutputFile cannot be empty. |
|
-5 |
Wrong format / invalid option for optNumFormat. |
|
-6 |
Failed to save output file. |
|
-7 |
Failed to create compatible bitmap. |
|
-10000 |
Project is not running. This error typically occurs when you try to call the function in the Watch window. See Notes below. |
Notes
This function behaves somewhat differently depending on where it is executed:
On the server
In order for the function to be executed on the project runtime server, the Viewer task (that is, the server's local Viewer program) must be started. The function can be called either by background tasks (for example, Script and Math worksheets) or in the Watch window, but it will fail if the Viewer task is not also started. This is because the Viewer task is used to render the screen. For more information about starting runtime tasks, see Runtime Tasks.
For projects running on Windows (using the SCADA runtime edition) and Windows Embedded (using the Embedded HMI runtime edition), the screen may be either open or closed.
optStrOutputFile is optional; if no value (or "") is specified, the file is saved in the Web sub-folder of the project folder and the file name is either the value of optStrScreenName (if specified) or simply ScreenShot.jpg. For example: <project name>\Web\ScreenShot.jpg
Secure Viewer
If the function is executed by Secure Viewer running on a remote station, the screen may be either open or closed. Also, optStrOutputFile is required; you must specify a complete file path and name for the output file.
Web Thin Client
If the function is executed by Web Thin Client running in Internet Explorer on a remote station, the screen must be open. Also, optStrOutputFile is required; you must specify a complete file path and name for the output file.
Note: Internet Explorer must be running with administrator privileges in order to be able to save output files.
Examples
Take a screen shot of the current screen, and then save it as ScreenShot.jpg:
SaveScreenShot()
Take a screen shot of main.scc, and then save it as main.jpg:
SaveScreenShot("main.scc")
Take a screen shot of the current screen, and then save it as a bitmap with the name of the currently logged user:
SaveScreenShot("",UserName,0)