COM object EvFileCollection

EvApplication > EvFileCollection

 

View the COM map and the COM summary.

The EvFileCollection object allows access to a set of EV files.

To access the EV files:

  • as a list
  • to iterate through all open EV files
  • to search for an EV file by file name

EvFileCollection methods and properties:

Count
FindByName
Item

 

Description

Count

(read-only) integer Count

Summary

Get the number of EV files in this collection. That is, the number of EV files the application has open.

FindByFileName

FindByFileName(string Name)

Summary

Searches for an open EV file by its filename, and if found returns the EvFile object for it.

Parameters
  • Name
  • The filename to search for.

Item

(read-only) Item[]

Summary

Gives access to a specific EV file by index. Indexes are zero-based, so valid indexes are from 0 to Count-1. The result is an EvFile object.

Item is the default property for this interface. See the example usage below for how to use this property.

Example usage

EvFileCollection is very useful for iterating through all open EV files. For example, the following script shows the file name of each open EV file in a series of message boxes:

  Dim EvApp 
  Set EvApp = CreateObject("EchoviewCom.EvApplication") 
  
  Dim FIndex
For FIndex = 0 to EvApp.EvFiles.Count-1
MsgBox EvApp.EvFiles.Item(FIndex).FileName
Next

Because Item is the default property for this interface, in many languages you can omit the Item specifier when accessing by index:

  For FIndex = 0 to EvApp.EvFiles.Count-1 
  MsgBox EvApp.EvFiles(FIndex).FileName 
  Next  
    

You can search for an EV file that has already been opened if you know its filename. This example also shows testing for an invalid object, to handle the situation where the EV file was not open in Echoview and as a result the FindByFileName method could not return it.

  Dim MyFile
  Set MyFile = EvApp.EvFiles.FindByFileName("c:\Example.EV")
  ' If this file was found, print the filename of the resulting object
  If Not MyFile Is Nothing Then
  MsgBox MyFile.FileName
  Else
  MsgBox "The EV file was not found."
  End If
  

See also

Scripting with COM objects
EvFile object
COM object hierarchy