ReadINI

(System Library)

Description: This subroutine read a variable entry from an INI file or a buffer containing one and returns its value.  Will not access .Startup or .Dynamic files.
Note: Access to configuration files is not reliable unless the caller holds the working copy lock. Acquiring the lock is a steady-state only operation, and therefore legacy operations that used script-mode access to these files are deprecated or no longer supported (see comments)
Returns: Varies
Usage: Script only.
Function Groups: File I/O
Related to: ReadConfiguration | CheckFileExist | CheckPathExist | ReadSectINI | WriteINI | WriteSectINI |
Format: System.ReadINI(File, Section, VarName [, UseBuff])
Parameters:  
File
Required. Any text expression giving the absolute path and file name of the configuration file or the actual buffer containing its contents, depending on the UseBuff parameter.
Section
Required. Any text expression giving the name of the section in the file. This should not include the square brackets delimiting the section.
VarName
Required. Any text expression giving the name of the variable for which the value is required.
UseBuff
An optional parameter that is any logical expression. If true (non-0) the value of File must be a buffer, if false (0) it is a file that is to be used. The default used if this parameter is omitted is false.
Comments:

For developers the lock means that access to VTScada working copy files, both reading and writing, should not be done without having the lock. The lock is across all applications and system layer VTScada code. The lock prevents two different piece of code from changing the same code such that one piece of code sees inconsistent data while the other code is in the middle of changing it

This module is a member of the System Library, and must therefore be prefaced by \System. as shown in the "Format" section.

If your application predates version 11.2, use the backslash notation rather than dot: \System\

The return value will be invalid if the configuration file, section or variable was not found. Searches performed by this function are case insensitive.

Example:

If 1 Main;
[
  DSource = System.ReadINI("C:\VTScada\Setup.INI" { Name of file },
                           "System" { Name of section },
                           "OrderlyShutdown" { Name of variable },
                           0 { Read file format });
]

This assigns the value of the variable OrderlyShutdown in the System section of the Setup.INI file to the variable called DSource.