ShortName Property

Applies to TestComplete 15.40, last modified on July 05, 2022

Description

The ShortName property returns a short version of the folder name (without the folder’s path). If this format is used, folder names do not exceed 8 characters. This naming convention was adopted in MS-DOS.

Declaration

aqFolderInfoObj.ShortName

Read-Only Property String
aqFolderInfoObj An expression, variable or parameter that specifies a reference to an aqFolderInfo object

Applies To

The property is applied to the following object:

Property Value

A string containing the short folder name (without the folder’s path).

Example

The code below obtains the short name of the specified folder and posts this name to the test log.

JavaScript, JScript

function ShortNameExample()
{
  // Specifies the fully qualified folder name
  var sPath = "C:\\MyFiles\\SubFolder";
  
  // Obtains the folder's short name
  var sName = aqFileSystem.GetFolderInfo(sPath).ShortName;
  
  // Posts the folder's short name to the test log
  Log.Message("The folder's short name is: " + sName);
  
}

/*
The routine produces the following output:

The folder's short name is: SUBFOL~1.TXT
*/

Python

def ShortNameExample():
  # Specifies the fully qualified folder name 
  sPath = "C:\\MyFiles\\SubFolder"
  # Obtains the folder's short name 
  sName = aqFileSystem.GetFolderInfo(sPath).ShortName
  # Posts the folder's short name to the test log 
  Log.Message("The folder's short name is: " + sName)

# The routine produces the following output: 
# The folder's short name is: SUBFOL~1.TXT

VBScript

Sub ShortNameExample

  ' Specifies the fully qualified folder name
  sPath = "C:\MyFiles\SubFolder"
  
  ' Obtains the folder's short name
  sName = aqFileSystem.GetFolderInfo(sPath).ShortName
  
  ' Posts the folder's short name to the test log
  Call Log.Message("The folder's short name is: " + sName)
  
End Sub

' The routine produces the following output:
' The folder's short name is: SUBFOL~1.TXT

DelphiScript

function ShortNameExample;
var sPath, sName;
begin

  // Specifies the fully qualified folder name
  sPath := 'C:\MyFiles\SubFolder';
  
  // Obtains the folder's short name
  sName := aqFileSystem.GetFolderInfo(sPath).ShortName;
  
  // Posts the folder's short name to the test log
  Log.Message('The folder''s short name is: ' + sName);
  
end;

{*
The routine produces the following output:

The folder's short name is: SUBFOL~1.TXT
}

C++Script, C#Script

function ShortNameExample()
{
  // Specifies the fully qualified folder name
  var sPath = "C:\\MyFiles\\SubFolder";
  
  // Obtains the folder's short name
  var sName = aqFileSystem["GetFolderInfo"](sPath)["ShortName"];
  
  // Posts the folder's short name to the test log
  Log["Message"]("The folder's short name is: " + sName);
  
}

/*
The routine produces the following output:

The folder's short name is: SUBFOL~1.TXT
*/

See Also

Working With Files From Scripts
GetFolderInfo Method
Name Property
ShortPath Property
GetShortPathName Method

Highlight search results