Promotic
WikipediaLinkedInYoutubeTwitterFacebook

FileSetAttr - method of object Pm

Description:
Setting 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 attribute archive is set/reset in the file.
2 - The attribute read only is set/reset in the file.
4 - The attribute hidden 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 attribute archive is set in the file.
2 - If the value is set and the corresponding bit in the parameter nMask is enabled, then the attribute read only is set in the file.
4 - If the value is set and the corresponding bit in the parameter nMask is enabled, then the attribute hidden 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 attribute read only, 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 attribute read only, 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 attributes archive and read only, see the parameter nMask = 1+2. The attribute archive is set and the attribute read only 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
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