User Guide
678 Chapter 3: ColdFusion Functions
SetProfileString
Description
Sets the value of a profile entry in an initialization file.
Returns
An empty string, upon successful execution; otherwise, an error message.
Category
System functions
Function syntax
SetProfileString(iniPath, section, entry, value)
See also
GetProfileSections, GetProfileString, SetProfileString
Parameters
Example
<h3>SetProfileString Example</h3>
This example uses SetProfileString to set the timeout value in an
initialization file. Enter the full path of your initialization
file, specify the timeout value, and submit the form.
<!--- This section checks whether the form was submitted. If so, this
section sets the initialization path and timeout value to the
path and timeout value specified in the form --->
<cfif Isdefined("Form.Submit")>
<cfset IniPath = FORM.iniPath>
<cfset Section = "boot loader">
<cfset MyTimeout = FORM.MyTimeout>
<cfset timeout = GetProfileString(IniPath, Section, "timeout")>
<cfif timeout Is Not MyTimeout>
<cfif MyTimeout Greater Than 0>
<hr size = "2" color = "#0000A0">
<p>Setting the timeout value to <cfoutput>#MyTimeout#</cfoutput>
</p>
<cfset code = SetProfileString(IniPath,
Section, "timeout", MyTimeout)>
<p>Value returned from SetProfileString:
<cfoutput>#code#</cfoutput></p>
<cfelse>
<hr size = "2" color = "red">
<p>Timeout value should be greater than zero in order to
provide time for user response.</p>
<hr size = "2" color = "red">
</cfif>
Parameter Description
iniPath Absolute path of initialization file
section Section of the initialization file in which the entry is to be set
entry Name of the entry to set
value Value to which to set the entry