Update cookies preferences
Promotic

FileTextReplace - method of the Pm object

Description:
The method searches for each occurrence of the Key text in the FileSrc file, replaces the Key text by the Val value and saves the result into the FileDst file.
Syntax:
Empty FileTextReplace(String FileSrc, String FileDst, String Key, Variant Val)
Parameters:
FileSrc(String) Path and file name whose the Key value will be replaced by the Val value.
It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files or folders.
FileDst(String) Path and file name in which the replacement is performed.
It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files or folders.
Key(String) Text in the FileSrc file that has to be replaced in the FileDst file by the Val value
Val(Variant) Value by which the Key item of the FileSrc file has to be replaced
Note:
If the Val is an array, then the replacement begins with the value on the index 0, every next occurrence of the Key item increases the Val array index by one.
If the end of the Val array is achieved, then it is again indexed from 0.

The result is stored into the FileDst file.
If the FileDst file already exists, then it'll be overwritten.

This method is not functional in Web panels.
Example:
Let's have the DataSrc.txt file with the following content:
1 = _Data_
2 = _Data_
3 = _Data_
4 = _Data_
After the script execution the DataDst.txt file is created with the following content:
1 = 10
2 = 20
3 = Hallo
4 = 10
Script:
JavaScriptVBScriptSelect and copy to clipboard

var arr = Pm.Array1(10, 20, "Hallo");
Pm.FileTextReplace("#app:DataSrc.txt", "#app:DataDst.txt", "_Data_", arr);
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

Send page remarkContact responsible person
Navigation:
 
- Pm
 
- Abs
- Cos
- E
- Exp
- FileTextReplace
 
 
- LN2
- PI
- Pow
- Sin
- Tan
© MICROSYS, spol. s r.o.