INIFILE

Top  Previous  Next

Syntax:

 

INIFILE OPEN, <inifile name>

INIFILE OPEN, <file name>, XML [VDS6]

INIFILE WRITE, <section name>, <value name>, <string>

INIFILE DELETE, <section name> {, <value name> } [VDS6]

INIFILE CLOSE

Description:

 

This command is used to open and change text-based configuration files. These may either be standard Windows .ini files, or [VDS6] XML format files.

Note: Windows .ini files suffer from several limitations, like the inability to use control characters in values, and a restriction on the maximum size of the file to 64Kb. They are a legacy feature that may not be supported in future versions of Windows. XML files do not have either of these restrictions. Windows keeps open .ini files in memory, so they are quite efficient to use, and changes made by one application can immediately be read by another that has opened the same file. XML files are managed entirely by the DialogScript program, and changes are only made public when the file is closed and it is saved to disk. Both configuration file types require the user of the program to have write access to the folder where the file is kept, which makes them more suitable for software that will only be run by an administrator. For other types of application it is better to store configuration settings in the registry.

The INIFILE OPEN command sets the name of the configuration file that will be used by any succeeding INIFILE command and @INIREAD function. The optional parameter XML specifies that the configuration file is to use XML format.

The INIFILE WRITE command writes a value named <value name> under the section <section name> with the value of <string> in the currently open configuration file.

The INIFILE DELETE command deletes the value named <value name> from  the section <section name> in the currently open configuration file. If <value name> is not specified, then the entire section <section name> is deleted.

The INIFILE CLOSE command closes the currently open configuration file and ensures that any changes are flushed to disk.

 

OK:

 

Set to false if the command fails.

 

Example:

 

INIFILE OPEN,MYSCR.INI

INIFILE WRITE,Data,Name,Fred Bloggs

 

See also: