Update cookies preferences
Promotic

FileSetAttr - method of the Pm object

Description:
Sets the file attributes.
Syntax:
Boolean FileSetAttr(String sFile, Long nMask, Long nValue)
Parameters:
sFile(String) The file whose attributes have to be changed.
If a full path is not entered, then it is completed relative to the application folder.
It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files or folders.
nMask(Long) Specifies which attributes have to be set. For example, 1+2 enables setting the attributes "archive" and "read only". These attributes are set or reset according to setting the corresponding bits in the nValue parameter.
1 - The "archive" attribute is set/reset in the file.
2 - The "read only" attribute is set/reset in the file.
4 - The "hidden" attribute is set/reset in the file.
nValue(Long) The value of attributes for setting. It is possible to enter a combination of bits, for example 1+2, i.e. the file has set the attributes "archive" and "read only". Setting the corresponding bits has to be enabled in the nMask parameter.
1 - If the value is set and the corresponding bit in the nMask parameter is enabled, then the "archive" attribute is set in the file.
2 - If the value is set and the corresponding bit in the nMask parameter is enabled, then the "read only" attribute is set in the file.
4 - If the value is set and the corresponding bit in the nMask parameter is enabled, then the "hidden" attribute is set in the file.
Return value:
true - on success
false - on error
Note:
The FileGetLength method can be used to get the file size.

This method is not functional in Web panels.
See also:
Example1:
Sets the "read only" attribute, see parameter nMask = 2 and parameter nValue = 2.
JavaScriptVBScriptSelect and copy to clipboard

var sFile = "#app:file.txt";
var retval = Pm.FileSetAttr(sFile, 2, 2);
if (retval)
{
// If the attribute was set OK
}
Example2:
Resets the "read only" attribute setting, see parameter nMask = 2 and parameter nValue = 0.
JavaScriptVBScriptSelect and copy to clipboard

var sFile = "#app:file.txt";
var retval = Pm.FileSetAttr(sFile, 2, 0);
if (retval)
{
// If the attribute setting was reset OK
}
Example3:
Sets the "archive" and "read only" attribute, see parameter nMask = 1+2. The "archive" attribute is set and the "read only" attribute is reset, see parameter nValue = 1.
JavaScriptVBScriptSelect and copy to clipboard

var sFile = "#app:file.txt";
var retval = Pm.FileSetAttr(sFile, 1 + 2, 1);
if (retval)
{
// If the attributes were set OK
}
PROMOTIC 9.0.31 SCADA system documentation MICROSYS, spol. s r.o.

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