Introduction

The scripting tool of Echoview is a powerful too and can easily be integrated in R.

There are two ways to achieve an interaction easily, the first purely through COM interaction with the RDCOMCLient library (RDCOMCLient) or even easier through EchoviewR (Harisson et al. 2015,  the EchoviewR repository )

Open / Close and Save files

The RDCOMClient example:


#Load the RDCOM library for COM interaction
library(RDCOMClient)

#Find all RAW files in a folder and its subfolders
allRaw<-list.files(paste(getwd(),sep=""), pattern='\\.raw$', recursive=T, full.names=T)

#open Echoview
EVAppObj <- COMCreate('EchoviewCom.EvApplication')

#open an EV template or file
filename<-paste(getwd(),"Echoview/MyEVFile.EV",sep="")
EVFile<-EVAppObj$OpenFile(filename)
fileset<-"Fileset1"
#Remove all raw data
EVClearRawData(EVFile=EVFile,filesetName=fileset)
#Add Raw Data
EVAddRawData(EVFile=EVFile,filesetName=fileset,dataFiles=allRaw)

#create a New EV File
EVAppObj$NewFile()
#create a new file based on a template
EVAppObj$NewFile(filename)

#Save Ev File
EVFile$Save()
#Save EV File as
EVFile$Save("D:/test.EV)
#Close EV File
EVFile$Close()

It is even easier with EchoviewR:


#load libraries
library(RDCOMClient)

#Load EchoViewR
source("D:\\Projects\\Carolina_M Echoview\\R\\EchoviewR.R")

#Always start with opening an Echoview instance through COM interaction
#Open Echoview - create a COM Connection
EVAppObj <- COMCreate('EchoviewCom.EvApplication')

#open an EV File
EVFilename <- "D:\\Projects\\Carolina_M Echoview\\templates\\vmr.EV"
EVFile <- EVOpenFile(EVAppObj, EVFilename)$EVFile

#Clear all raw files in the fileset
EVClearRawData(EVFile, "Fileset1")

#Save EVFile
EVSaveFile(EVFile)

#Close EVFIle
EVCloseFile(EVFile)

#Create a new EV File
EVFile <- EVNewFile(EVAppObj)$EVFile

#...or create a new file based on a template
EVFile <- EVNewFile(EVAppObj,templateFn = EVFilename)$EVFile

#Save EV File As
EVSaveAsFile(EVFile, "D:/test.EV")

#Create a fileset
EVCreateFileset(EVFile, "MyFileset")

#Add Raw Data
EVAddRawData(EVFile, "MyFileset", "myRawFIle.Raw")

#Find a fileset
EVFindFilesetByName(EVFile, "MyFileset")

#FInd Start and End TIme of the FIleSet
EVFindFilesetTime(EVFile,"Fileset1")