Project.FileName Property

Applies to TestComplete 14.20, last modified on September 11, 2019

Description

The FileName property returns the fully-qualified name (with the extension) of the file that holds the current TestComplete project.

Declaration

Project.FileName

Read-Only Property String

Applies To

The property is applied to the following object:

Property Value

A string that represents the file name (with the file’s path and extension) of the current project in TestComplete.

Example

The following example demonstrates how to obtain the name of the current project file and how to copy the file to the specified folder.

JavaScript, JScript

function ProjectSample()
{

  var FileName, NewPath;

  // Obtains the name of the current project’s file with the full path to it
  FileName = Project.FileName;
  // Specifies the destination path
  NewPath = "..\\..\\..\\..\\Temp\\TempProject.mds";
  // Copies the project file
  if (aqFile.Copy(FileName, NewPath))
    Log.Message("The file has been copied successfully");
  else
    Log.Error("Failed to copy the file");

}

Python

def ProjectSample():
  # Obtains the name of the current project's file with the full path to it 
  FileName = Project.FileName
  # Specifies the destination path 
  NewPath = "..\\..\\..\\..\\Temp\\TempProject.mds"
  # Copies the project file 
  if aqFile.Copy(FileName, NewPath):
    Log.Message("The file has been copied successfully")
  else:
    Log.Error("Failed to copy the file")

VBScript

Sub ProjectSample

  Dim FileName, NewPath

  ' Obtains the name of the current project’s file with the full path to it
  FileName = Project.FileName
  ' Specifies the destination path
  NewPath = "..\..\..\..\Temp\TempProject.mds"
  ' Copies the project file
  If aqFile.Copy(FileName, NewPath) Then
    Log.Message "The file has been copied successfully"
  Else
    Log.Error "Failed to copy the file"
  End If

End Sub

DelphiScript

procedure ProjectSample();
var FileName, NewPath;

begin

  // Obtains the name of the current project’s file with the full path to it
  FileName := Project.FileName;
  // Specifies the destination path
  NewPath := '..\..\..\..\Temp\TempProject.mds';
  // Copies the project file
  if aqFile.Copy(FileName, NewPath) then
    Log.Message('The file has been copied successfully')
  else
    Log.Error('Failed to copy the file');

end;

C++Script, C#Script

function ProjectSample()
{

  var FileName, NewPath;

  // Obtains the name of the current project’s file with the full path to it
  FileName = Project["FileName"];
  // Specifies the destination path
  NewPath = "..\\..\\..\\..\\Temp\\TempProject.mds";
  // Copies the project file
  if (aqFile["Copy"](FileName, NewPath))
    Log["Message"]("The file has been copied successfully");
  else
    Log["Error"]("Failed to copy the file");

}

See Also

Project.Path
Project.ConfigPath
ProjectSuite.Path
ProjectSuite.FileName

Highlight search results