ImportSecuritySystem
- Last UpdatedOct 29, 2026
- 3 minute read
This function imports a security system configuration from an external file.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
ImportSecuritySystem |
Security |
Synchronous |
No |
Supported |
Supported |
Not supported |
Not supported |
Not supported |
Syntax
ImportSecuritySystem("strSecuritySystemPassword", "strFileName", "strFilePassword", optNumMode)
strSecuritySystemPassword
The Security System Main Password of the current (importing) application. If there is no Security System Main Password, use an empty string ("").
strFileName
The file path and name of the file. If the file is located inside the project folder, specify either just the file name or the file path relative to that folder. If the file is located outside the project folder, specify the absolute file path. This function requires a security system configuration file that was previously exported from an application using either the Security System configuration tool or the function ExportSecuritySystem.
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).
strFilePassword
The Security System Main Password of the application from which the specified configuration file was exported. If there was no Security System Main Password, either do not use this parameter or use an empty string ("") so that you can specify the next parameter.
optNumMode
A numeric flag indicating how the imported settings should be handled:
|
Value |
Description |
|---|---|
|
0 |
Append the imported settings to the current settings. In the event of a conflict, replace with the imported settings. |
|
1 |
Append the imported settings to the current settings. In the event of a conflict, keep the current settings. |
|
2 |
Completely replace the current settings with the imported settings. |
This parameter is optional; if no value is specified, the default value is 0.
Return value
This function returns one of the following values:
|
Value |
Description |
|---|---|
|
-2 |
Wrong parameter type. |
|
-1 |
Too many parameters. |
|
0 |
Could not read security data. This may be due to incorrect password values. |
|
1 |
File imported successfully. |
Notes
The exported security system configuration file can be imported into an application
This function can be called only from scripts executed on the project server. None of the connected clients โ not even the client running on the same computer as the project server, because it runs as a separate process on that computer โ have the necessary access to the security system. Therefore, generally speaking:
-
It can be called from the following VBScript Interfaces: Startup Script (which is executed when the project itself is run), Script Groups (which are continuously executed by the Background Task), and any Global Procedures called by them; and
-
It cannot be called from the VBScript graphics interfaces, including the Graphics Script (which is executed separately by each client), Screen Scripts (which are attached to individual screens), and Command animations.
For more information, see VBScript Interfaces.
To work around this limitation, create a Script Group that actually calls the function, configure an appropriate tag/expression trigger in the Execution box of the Script worksheet, and then create a project screen that somehow changes the value of that tag/expression. Therefore, when a user on a connected client uses the screen to change the value, the Script Group will be executed on the project server.
Examples
Import a security system configuration file that was exported from another application. The exporting application had a Security System Main Password pr3vPa55w0rd and the current importing application has a Security System Main Password cUrrPa55w0rd. The imported security system configuration will be appended to the current security system configuration, but will overwrite conflicting configurations.
ImportSecuritySystem("pr3vPa55w0rd", "C:\security.txt", "cUrrPa55w0rd")
Import a security system configuration file that was exported from another application. The exporting application had a Security System Main Password pr3vPa55w0rd and the current importing application has a Security System Main Password cUrrPa55w0rd. The imported security system configuration will overwrite the importing application's security system configuration.
ImportSecuritySystem("pr3vPa55w0rd", "C:\security.txt", "cUrrPa55w0rd", 2)
Import a security system configuration file that was exported from another application. The exporting application did not have a Security System Main Password and neither does the current importing application. The imported security system configuration will overwrite the the importing application's security system configuration.
ImportSecuritySystem("", "C:\security.txt", "", 2)