Description
The NamesList
method lets you get all item names in the Files
, Objects
or Regions
collection as one string, in index order, separated by line breaks (0Dh, 0Ah)
by default.
Declaration
ProgObj.NamesList(Separator)
ProgObj | An expression, variable or parameter that specifies a reference to one of the objects listed in the Applies To section | |||
Separator | [in] | Optional | String | Default value: \r\n |
Result | String |
Applies To
The method is applied to the following objects:
Parameters
The method has the following parameter:
Separator
The string that will be used to separate individual item names in the returned list. By default, this string is “\r\n”, which means line breaks (0Dh, 0Ah)
.
Result Value
The string that contains all the item names in the collection.
Example
The following example demonstrates how you can get the names of items of the Files collection and the names of the corresponding stored files.
JavaScript, JScript
{
var i;
// Posts the names of the items stored in the Files collection
Log.Message(Files.NamesList());
// Posts the names of the files stored in the Files collection
Log.Message(Files.FileNamesList());
// Posts the total number of items stored in the Files collection
Log.Message("The total number of files: " + Files.Count);
// Iterates through the items of the collection and posts their names and the names of the corresponding files to the log
for (i = 0; i < Files.Count; i++)
Log.Message(Files.NameByIndex(i) + " stores " + Files.FileNameByIndex(i));
}
Python
def Test1():
# Posts the names of the items stored in the Files collection
Log.Message(Files.NamesList())
# Posts the names of the files stored in the Files collection
Log.Message(Files.FileNamesList())
# Posts the total number of items stored in the Files collection
Log.Message("The total number of files: " + str(Files.Count))
# Iterates through the items of the collection and posts their names and the names of the corresponding files to the log
for i in range(i, Count):
Log.Message(Files.NameByIndex[i] + " stores " + Files.FileNameByIndex[i])
VBScript
' Posts the names of the items stored in the Files collection
Log.Message(Files.NamesList())
' Posts the names of the files stored in the Files collection
Log.Message(Files.FileNamesList())
' Posts the total number of items stored in the Files collection
Log.Message("The total number of files: " & Files.Count)
' Iterates through the items of the collection and posts their names and the names of the corresponding files to the log
For i = 0 To Files.Count-1
Log.Message(Files.NameByIndex(i) & " stores " & Files.FileNameByIndex(i))
Next
End Sub
DelphiScript
var
i : OleVariant;
begin
// Posts the names of the items stored in the Files collection
Log.Message(Files.NamesList());
// Posts the names of the files stored in the Files collection
Log.Message(Files.FileNamesList());
// Posts the total number of items stored in the Files collection
Log.Message('The total number of files: ' + Files.Count);
// Iterates through the items of the collection and posts their names and the names of the corresponding files to the log
for i := 0 to Files.Count-1 do
Log.Message(Files.NameByIndex(i) + ' stores ' + Files.FileNameByIndex(i));
end;
C++Script, C#Script
function Test1()
{
var i;
// Posts the names of the items stored in the Files collection
Log["Message"](Files["NamesList"]());
// Posts the names of the files stored in the Files collection
Log["Message"](Files["FileNamesList"]());
// Posts the total number of items stored in the Files collection
Log["Message"]("The total number of files: " + Files["Count"]);
// Iterates through the items of the collection and posts their names and the names of the corresponding files to the log
for (i = 0; i < Files["Count"]; i++)
Log["Message"](Files["NameByIndex"](i) + " stores " + Files["FileNameByIndex"](i));
}