Command Reference

Read from INI File

Reads a value from an INI file and stores it in a variable.

Action ID: 13
Action Category: INI Files

Settings

Variable name

The name of the variable to store the result in.

Default value

The default value to assign the variable if the INI file, section or value name does not exist or cannot be read.

File name

The name of the INI file.

Section

The INI file section to read from.

Value name

The name of the INI file value to read from the section.

Return Values

Value
(%LastErrorNum%)

Simple Message
(%LastErrorMsg%)

Verbose Message
(%LastErrorDetails%)

0 (OK)

 

 

1

Could not read from INI file.

File not found.
<<File name>>

2

Could not read from INI file.

Could not read value.
<<File name>>: [<<Section>>] - <<Value Name>>

Example

In this example, we will read a user's name from a private INI file in the user's Windows directory called "info.ini" that was put there by a previous installation. The data is in the section called "UserData", in the "UserName" value.

We will store this information in a custom variable named %UserName%.

Note: %WinDir% is a built-in variable.

Variable name: %UserName%
Default value: Unknown User
File name: %WinDir%\info.ini
Section: UserData
Value name: UserName

 

See Also: Alphabetical List of Actions, Categorical List of Actions, On Error tab