Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SixteenApplication (continued)

PutSetting Function

Overview

The PutSetting function writes or replaces a single line item as a string to a Windows style initialization (ini) file.

Syntax/Parameters

Syntax

int = PutSetting ( [string fnTarget], string section, string entry, string data | long data );

Parameters

fnTarget

An optional string defining the target file to store the settings. If the parameter is omitted (i.e., there are only two string parameters provided to the function), the target name will be the name of the script plus an ini script with the path being located in the application’s roaming profile area. For example, if the script name is “Production Interface.ls” the target will default to “%appdata%/application/Production Interface.ini”. Where %appdata% is the user’s roaming profile, normally located in the user data area under “AppData” and the application is the vendor application area, for example “Novaworks”. If the string is supplied but is empty, the default application workstation settings file is used for the target. If a filename is provided without a path, the file is referenced from the application data folder (%appdata%).

section

A string specifying the section (also known as the application name) in which the entries are grouped. This is name contained within brackets inside the target file. Every entry must belong to a section.

entry

A string specifying the entry name (also known as the key name) identifying the data. The entry identifies the line item within the section. For example, the line entry within a section, ‘My Key=Some Data”, the ‘My Data’ field is the entry or key name and ‘Some Data’ is the data associated with the key.

data

A string or an integer (up to 64 bits) to write as the entry.

Return Value

An int containing a formatted error code. ERROR_NONE for no error or an error code.

Remarks

If the specified settings file does not exist, it is automatically created. If the target is located in the user’s roaming data area, it will be private to that user and possibly available on other workstations the user logged into (provided roaming profiles are enabled).

The process must have privileges to write to the specified target location.

Note that many applications employ two ini files: preferences and workstation settings. The ‘application.ini’ file contains the workstation settings while ‘application settings.ini’ contains the preferences. Workstation settings contain information such as the file history list, window positions, etc. The preferences (settings) file contains operation preferences such as import settings, editing default information, etc. Script programs should avoid writing to the preferences since they are managed in a manner that will result in unknown information being purged anytime the settings are changed within the application preference dialogs.

Related Function

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic