ShortName Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

The ShortName property holds a short file name (without the file’s path) with the extension. If this format is used, file names do not exceed 8 characters and the extension is not longer than 3 characters. This naming convention was adopted in MS-DOS.

Declaration

aqFileInfoObj.ShortName

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

Applies To

The property is applied to the following object:

Property Value

A string containing the shortened file name.

Example

The code below obtains the short name (with extension) of the specified file and posts this name to the test log.

JavaScript, JScript

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

/*
The routine produces the following output:

The file's short name is: FILELO~1.TXT
*/

Python

def ShortNameExample():
  # Specifies the fully qualified file name 
  sPath = "C:\\MyFiles\\FileLongName.txt"
  # Obtains the file's short name 
  sName = aqFileSystem.GetFileInfo(sPath).ShortName
  # Posts the file's short name to the test log 
  Log.Message("The file's short name is: " + sName)
  
# The routine produces the following output: 
#  The file's short name is: FILELO~1.TXT

VBScript

Sub ShortNameExample

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

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

DelphiScript

function ShortNameExample;
var sPath, sName;
begin

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

{*
The routine produces the following output:

The file's short name is: FILELO~1.TXT
}

C++Script, C#Script

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

/*
The routine produces the following output:

The file's short name is: FILELO~1.TXT
*/

See Also

Working With Files From Scripts
aqFileSystem.GetFileInfo Method
aqFileSystem.FindFiles Method
Name Property
ShortPath Property
aqFileSystem.GetShortPathName Method

Highlight search results