PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Example 1: Retrieving the attributes of a file
  • Example 2: Modifying the attributes of a file
fAttribute (Example)
Example 1: Retrieving the attributes of a file
The following code is used to find out the attributes of a file.
// Declare and initialize the variables
ResAttribute is string
FilePath is string
FileAtt is string = "The file is:"
// Attributes of the file?
ResAttribute = fAttribute(FilePath)
IF ResAttribute <> "ERR" THEN
IF Position(ResAttribute, "A") THEN FileAtt = FileAtt + CR + ...
TAB + "- an archive file"
IF Position(ResAttribute, "C") THEN FileAtt = FileAtt + CR + ...
TAB + "- a compressed file"
IF Position(ResAttribute, "D") THEN FileAtt = FileAtt + CR + ...
TAB + "- a directory"
IF Position(ResAttribute, "H") THEN FileAtt = FileAtt + CR + ...
TAB + "- a hidden file"
IF Position(ResAttribute, "R") THEN FileAtt = FileAtt + CR + ...
TAB + "- a read-only file"
IF Position(ResAttribute, "S") THEN FileAtt = FileAtt + CR + ...
TAB + "- a system file"
// Display the attributes of the file
Info(FileAtt)
ELSE
// Display the error message
Error(ErrorInfo(errMessage))
END
Example 2: Modifying the attributes of a file
WINDEVWEBDEV - Server codeReports and QueriesWindows MobileAjaxUser code (UMC)Stored procedures The following code is used to modify the attributes of a file. If this file is not "read-only" (letter R), the file automatically becomes read-only ("read-only" attribute, letter R).
// Declare the variables
ResAttribute is string
ResAttributeModif is string
FilePath is string
// Attributes of the selected file?
ResAttribute = fAttribute(FilePath)
IF ResAttribute <> "ERR" THEN
// The selected file is already read-only?
IF Position(ResAttribute, "R") <> 0 THEN
Info("The file is already read-only")
ELSE
ResAttribute = ResAttribute + "R"
// Modify the attributes of the file
ResAttributeModif = fAttribute(FilePath, ResAttribute)
IF ResAttributeModif <> "ERR" THEN
Info("The file is currently read-only")
END
END
END
IF ResAttribute = "ERR" OR ResAttributeModif = "ERR" THEN
// Display the error message
Error(ErrorInfo(errMessage))
END
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment