<< Click to Display Table of Contents >> Navigation: 3. Script Language > Filesystem-Commands > Filesystem-Commands |
MiniRobotLanguage (MRL)
CTI. Command
Copy to Inifile
Intention
This command is used to
• write entries into INI-Files,
• create INI files,
• delete keys, or
• delete sections from an INI-files.
When writing a value to an INI-File, the command
• checks if the length of the string to write is smaller then 65536 Bytes
(MAXLEN for INI-Files is 65535 Bytes)
• if not the string is shortened to that length
• then writes that value into the INI-File
• then reads that value back and verifies that it has been written properly.
Only in that case you get an success (1) in Parameter P5. In case the written and read values differ, you get an failed (0) in P5.
Here are the 4 Modes of operation:
1. CTI.Inifilename|Section -> Entire Section is been deleted
2. CTI.Inifilename|Section|Key -> Key is deleted
3. CTI.Inifilename|Section|Key|Value
' Copies the given Value into Key
4. CTI.Inifilename|Section|Key|Value|Success-Flag
' Copies the given Value into Key, succes-flag to 0/1
Mode 2: You can delete the key:
CTI.§§FIL|§§SEC|§§KEY
There will not be any warning or such. The key will just be deleted, therefore use this with care!
Using Mode 1, you can delete the whole section. Its not much to type, but the result can be fatal if you don't know what you do. Use with care also.
CTI.§§FIL|§§SEC
The maximum length of values to be read from INI-Files is 65535 Bytes (tested under Win XP). Therefore the value to be written will internally be shortened to this length, in case its longer then this. Even then you will get a writing success in P5.
Syntax
CTI.P1|P2[|P3][|P4][|P5]
Parameter Explanation
P1 - Filename of Ini to write to
P2 - Section-Name
P3 - Key-Name
P4 - Value
P5 - (out) Variable for Success-flag 1/0.
Example
'*****************************************************
' EXAMPLE 1: CTI. Write INI-File
'*****************************************************
VAR.§§FIL=?desktop\one.ini
VAR.§§SEC=Section
VAR.§§KEY=Key
VAR.§§VAL=Value
CTI.§§FIL|§§SEC|§§KEY|§§VAL|§§RES
IVV.§§RES=1
PRT. Ini was written with success!
ELS.
PRT. Ini was NOT written with success!
EIF.
' Now we write without check
CTI.§§FIL|§§SEC|§§KEY|§§VAL
' Now we read the file
EXO.§§FIL
MBX. Now we delete this key!
CTI.§§FIL|§§SEC|§§KEY
MBX. Now we delete the whole section!
CTI.§§FIL|§§SEC
END.
Remarks
-
Limitations:
The maximum length of values to be read from INI-Files is 65535 Bytes (XP). Therefore the value to be written will internally be shortened to this length, in case its longer then this. Even then you will get a writing success.
See also:
• IEF. / NEF. - If - exist - File