Checks, sets, and removes attributes for the specified file.
If the file name includes a directory name, the file is opened in the specified directory. Otherwise, Silk Performer searches for the file in the directory where the test script is located, in the data directory, in the results directory, and in the project directory.
Kernel.bdh
FAttribute( in sFileName : string, in nAttributes : number, in nOperation : number ): boolean;
true if the check operation was performed and the attribute was set or if the attribute was successfully added or removed.
false otherwise
Parameter | Description |
---|---|
sFileName | Name of the file |
nAttributes |
Attributes of the specified file. Any combination of the following flags is valid:
|
nOperation |
Specifies whether to check, set or remove attributes. Possible values are:
|
dcltrans transaction TMain const scFileName := "c:\\temp\\dummyfile.txt"; begin // check whether system file is hidden if FAttribute("c:\\io.sys",OPT_FILE_ATTRIB_HIDDEN, OPT_FILE_ATTRIB_GET) then write("hidden"); writeln; else write("visible"); writeln; end; // set read-only attribute for test file FAttribute(scFileName, OPT_FILE_ATTRIB_READONLY, OPT_FILE_ATTRIB_ADD); write("test file is now read-only"); writeln; // remove read-only attribute again FAttribute(scFileName, OPT_FILE_ATTRIB_READONLY, OPT_FILE_ATTRIB_REMOVE); write("read-only attribute removed"); writeln; end TMain;
hidden test file is now read-only read-only attribute removed