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, then 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) 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 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, 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 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 - on success
false - on error
Note:
The FileGetLength method can be used to get the file size.
 
This method is not functional for Web panels in JavaScript language (and therefore it is not working in Web panels).
Example1:
Sets the "read only" attribute, see parameter nMask = 2 and parameter nValue = 2.
VBScriptSelect and copy to clipboard

Dim sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 2, 2)
If retval Then
  'If the attribute was set OK
End If
Example2:
Resets the "read only" attribute, see parameter nMask = 2 and parameter nValue = 0.
VBScriptSelect and copy to clipboard

Dim sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 2, 0)
If retval Then
  'If the attribute was reset OK
End If
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.
VBScriptSelect and copy to clipboard

Dim sFile, retval
sFile = "#app:file.txt"
retval = Pm.FileSetAttr(sFile, 1+2, 1)
If retval Then
  'If the attributes were set OK
End If
PROMOTIC 8.3.27 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