Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FileSetAttr - method of object Pm

Description:
Sets the file attributes.
Syntax:
FileSetAttr(sFile As String, nMask As Long, nValue As Long) As Boolean
Calling:
val = Pm.FileSetAttr(sFile, nMask, nValue)
Parameters:
sFile(String) The file whose attributes have to be changed. If a full path is not entered, it is completed relatively according to the application file folder.

It is recommended to use the PROMOTIC path syntax - see PROMOTIC path to files and folders.

nMask(Long) Determines which attributes have to be set. For example, 1+2 enables setting the attributes archive and read only. These attributes are set or reset depending on 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. A combination of bits can be set, for example 1+2, namely 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 parameter nMask is enabled, then the archive attribute is set in the file.
2 - If the value is set and the corresponding bit in the parameter nMask is enabled, then the read only attribute is set in the file.
4 - If the value is set and the corresponding bit in the parameter nMask is enabled, then the hidden attribute is set in the file.
Return Values:
true - operation passed successfully
false - operation failed
Note:
The FileGetLength method can be used to get the file size.
 
This method is not functional for Web panels.
Example1:
Sets the read only attribute, see the parameter nMask = 2 and the parameter nValue = 2.
Dim sAttr, sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 2, 2)
If retval Then
  'When the attribute was set OK.
End If
Example2:
Resets the read only attribute, see the parameter nMask = 2 and the parameter nValue = 0.
Dim sAttr, sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 2, 0)
If retval Then
  'When the attribute was reset OK.
End If
Example3:
Sets the archive and read only attributea, see the parameter nMask = 1+2. The archive attribute is set and the read only attribute is reset, see the parameter nValue = 1.
Dim sAttr, sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 1+2, 1)
If retval Then
  'When the attributes were set OK.
End If
PROMOTIC 8.3.19 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.Tavičská 845/21 703 00 Ostrava-Vítkovice