setProfileString

setProfileString(fileName: String;
                 section:  String;
                 keyName:  String;
                 string:   String): Boolean;

The setProfileString method of the Application class copies a string into the section of an initialization file specified in the section parameter.

This method returns true if it succeeds in storing the specified string. Conversely, if the value of the section or keyName parameter is null ("") or empty, this method returns false, to indicate that the JADE initialization file has not been updated. (Use the respective ProfileRemoveSection or ProfileRemoveKey global constant in the JadeProfileString category to delete a section or key, rather than passing a null or empty string in the appropriate parameter of this method.)

To retrieve a stored string, use the getProfileString method.

The parameters for the setProfileString method are listed in the following table.

Parameter Specifies the …
fileName Initialization file. If you set this parameter to windows, the win.ini file is used. If this parameter does not contain a full path to the file, Windows searches for the file in the Windows directory.
section Initialization file section containing the key (parameter) name.
keyName Name of the key (parameter) whose associated string is to be stored.
string String that is to be written to the file.

In JADE thin client mode, this method sets the initialization file string in the specified initialization file on the presentation client.

Use the Application class setProfileStringAppServer method to set the string in the JADE initialization file on the application server or process.setProfileString to set the string in the JADE initialization file of the application server process.

You can use this method to copy a string to a two-level section name (prefixed with a unique identifier) within a JADE initialization file shared by multiple programs on the host. For details, see "Two-Level Section Names" under "Format of the JADE Initialization File", in the JADE Initialization File Reference. However, you cannot use this method to update JADE initialization file parameter values specified on the command line. Attempts to do so return a value of false and the parameter values are unchanged.

The following example shows the use of this method to remove an entire [mySection] section and the WindowPos parameter in the [InternalAS.JadeAppServer] section from the JADE initialization file.

begin
    app.setProfileString(app.getIniFileName, "mySection",
                         ProfileRemoveSection, "");
    // If the user has moved the window, reset it to the default values
    app.setProfileString(app.getIniFileName, "JadeAppServer", "WindowPos",
                         ProfileRemoveKey);
end;