writeProfileInt
Description
Writes an integer value to the user's profile.
Profile values are identified by their section (sections begin with [section name]) and by the entry (or key) name.
Section groupings allow values to be organized in logical groups. They also allow values with the same name to be differentiated between different groups.
Specifying -file
allows the values to be written to a file of the user's choice.
The file does not have to have an "ini" extension.
Some users use the profile (or other file) as a "global variable" mechanism. While this is still supported, it is not recommended and has been superseded by actual global variables which allow you to have variables that persist between script executions. For more information, see the setGlobalVar command (and related commands).
Functional area
System
Command syntax
Syntax
writeProfileInt "sectionHeader" "entry" value [-file string] |
Arguments
Name | Type | Required | Comments |
---|---|---|---|
sectionHeader | string | yes | Logical grouping of the value. The section header is the part of the profile which is enclosed in square brackets (e.g. [My Section]) |
entry | string | yes | The entry name. This will be the first value on the line followed by an = sign. |
value | integer | yes | Value to write to the profile. |
Flags
Name | Flag arguments | Arg. type | Excl. to | Comments |
---|---|---|---|---|
file | 1 | string | — | Redirects output to another text file. The default is to output to the user's profile (.ini file). |
Return value
boolean
Returns true if the value was successfully written, otherwise false.
Examples
// Store some information in the profile int $value; // Write to Section 1 writeProfileInt "Section1" "Value1" 10; writeProfileInt "Section1" "Value2" -20; // Write to Section 2 writeProfileInt "Section2" "Value1" 10; writeProfileInt "Section2" "Value2" 20; /* Will produce output like this [Section1] Value1=10 Value2=-20 [Section2] Value1=10 Value2=20 */ // Now retrieve it $value = `getProfileInt "Section1" "Value1" 0`; print $value;