Utilities.FileSetAttr Method

Applies to TestComplete 15.62, last modified on March 19, 2024
This method is obsolete. See the Remarks section below.

Description

Use the Utilities.FileSetAttr method to set the attributes of the specified file. To address an attribute, use constants listed in the description of the FileGetAttr method. To combine several attributes, use the or operator. For instance, the following code makes the c:\MyFile.txt file read-only and hidden:

JavaScript, JScript

Utilities.FileSetAttr("C:\\MyFile.txt", Utilities.faReadOnly | Utilities.faHidden);

Python

Utilities.FileSetAttr("C:\\MyFile.txt", Utilities.faReadOnly | Utilities.faHidden)

VBScript

Utilities.FileSetAttr "C:\MyFile.txt", Utilities.faReadOnly Or Utilities.faHidden

DelphiScript

Utilities.FileSetAttr('C:\MyFile.txt', Utilities.faReadOnly or Utilities.faHidden);

C++Script, C#Script

Utilities["FileSetAttr"]("C:\\MyFile.txt", Utilities["faReadOnly"] | Utilities["faHidden"]);

Declaration

Utilities.FileSetAttr(FileName, Attr)

FileName [in]    Required    String    
Attr [in]    Required    Integer    
Result Integer

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

FileName

Specifies the file whose attributes you want to change.

Attr

Specifies the attributes to be set to the specified file.

Result Value

If the attributes have been set successfully, the function returns 0. Otherwise, it returns a Windows error code.

Remarks

This method is obsolete. It is supported for backward compatibility only. To set file’s attributes, use the aqFile.SetFileAttributes or aqFileInfo.SetFileAttributes method.

See Also

SetFileAttributes Method
SetFileAttributes Method
GetFileAttributes Method
Attributes Property
FindFiles Method
TSearchRec Object

Highlight search results