Commands & Syntax > Commands > File Mainpulation >

.INI READ - < ini_file_read >() ... [Pro]

www.perfectkeyboard.com

 

File .INI READ
<ini_file_read>("Section","Key","Variable to save data","File","Password")
Available in: Professional edition

The command reads data from a INI file. INI files internal structure look like this:
...

[Section]
Key1=Some data.
Key2=Other data.
...
KeyN=Even more data.

[Other Section]
Key1=....

...

The "ini_file_read" command reads data from given key in given section.

 

#

Parameter name

Parameter description

1

Section

Section name in INI file.

2

Key

Name of the key in the Section.

3

Variable to save data

Variable that receives data retrieved from the given key in given section.

4

File

(Full) path to the INI file.

5

Password

Password used to decrypt the data. The password must be the same that was previously used to encrypt data (in 'ini_file_write' or 'data_crypt' command). If incorrect password is provided then the command fails. Leave the parameter empty if the data are not encrypted.

 

Example (Macro Steps):

 

1

<#> <#> This sample writes and reads data from INI file.

2

<#> <#>

3

Macro execution: ONLY COMMANDS

4

<#> <#> Write some data to the INI file first

5

File .INI WRITE Section = "section1", Key = "key1", Data = "Value1", File = "%TEMP%\example.ini", Password = ""

6

<#> <#> Read the data then...

7

File .INI READ Section = "section1", Key = "key1", Variable to save data = "vValue", File = "%TEMP%\example.ini", Password = ""

8

<#> <#> ... and show the data.

9

Message SHOW "Information" : "vValue" (other parameters: x = -100, y = -100, Window title = Message, Buttons = OK, Timeout (seconds) = 0, Always on top = ).

10

<#> <#> In the end let's delete the ini file.

11

File DELETE "%TEMP%\example.ini" (Subfolders = No, Unused = 0, Retries = 3, Variable for number of processed files = , Variable for number of failures = , Log errors = , Show progress = No)

Example (Plain Text):

 

<#> This sample writes and reads data from INI file.

<#>

<cmds>

 

<#> Write some data to the INI file first

<ini_file_write>("section1","key1","Value1","%TEMP%\example.ini")

 

<#> Read the data then...

<ini_file_read>("section1","key1","vValue","%TEMP%\example.ini")

 

<#> ... and show the data.

<msg>(-100,-100,"vValue","Message",1,0,0)

 

<#> In the end let's delete the ini file.

<filedel>("%TEMP%\example.ini",0,0,3,,,"",0)