Files.CreateEmpty Method

Applies to TestComplete 14.70, last modified on April 22, 2021

Description

The Files.CreateEmpty method lets you create a new file on the disk, add this file to the Files collection and save it there under the given name.

Declaration

Files.CreateEmpty(FileNameName)

FileName [in]    Required    String    
Name [in]    Required    String    
Result Boolean

Applies To

The method is applied to the following object:

Parameters

The method has the following parameters:

FileName

The name the file will have when it is created.

Name

A unique name under which the file will be saved to the Files collection.

Result Value

The CreateEmpty method returns True if the file was created and added to the Files collection successfully. Otherwise, it returns False.

If the collection already contains an item with the specified name, the method returns False and does not overwrite the file reference in the project.

Remarks

Files created via the Files.CreateEmpty method are located in the ProjectSuiteName\ProjectName\Stores\Files folder of the current TestComplete project.

Example

The following code snippet creates a new empty file on the disk and adds it to the Files collection.

JavaScript, JScript

Files.CreateEmpty("D:\\Files\\MyFile.txt", "MyFile_txt");

Python

Fies.CreateEmpty("D:\\Files\\MyFile.txt", "MyFile_txt")

VBScript

Call Files.CreateEmpty("D:\Files\MyFile.txt", "MyFile_txt")

DelphiScript

Files.CreateEmpty('D:\Files\MyFile.txt', 'MyFile_txt');

C++Script, C#Script

Files["CreateEmpty"]("D:\\Files\\MyFile.txt", "MyFile_txt");

See Also

Add Method
Remove Method

Highlight search results