setProfileString

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

The setProfileString method of the Process class copies a parameter (key name) string into the specified section of the initialization file of the process.

A method on a specific process instance performs its action on the owning node (that is, a process.node instance) if the process is not associated with a presentation client. If the process has an associated presentation client, the action is performed on the presentation client. The presentation client does not have to be the current presentation client or a presentation client attached to the same application server.

Use the Application class setProfileStringAppServer method or Node class setProfileString method to set the string on the application server.

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 Description
fileName Specifies the 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 Specifies the initialization file section containing the key (parameter) name.
keyName Specifies the name of the key (parameter) whose associated string is to be stored.
string Specifies the string that is to be written to the file.

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
    process.setProfileString(process.getIniFileName, "mySection",
                             ProfileRemoveSection, "");
    // If the user has moved the window, reset it to the default values
    process.setProfileString(process.getIniFileName, "JadeAppServer",
                             "WindowPos", ProfileRemoveKey);
end;