''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' EV script 003 - Pick and export lines in all EV files in a folder ' Example Echoview COM script downloaded from www.echoview.com ' For support, contact the Echoview support team ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim EvFileFolderName: EvFileFolderName = "S:\! Support\Data and EV files\Kyle Byers\2010 06 script\Bri script testing" Dim ExportLineFolderName: ExportLineFolderName = "S:\! Support\Data and EV files\Kyle Byers\2010 06 script\Bri script testing\Picked Lines\" Dim fso: Set fso = CreateObject("Scripting.FileSystemObject") Dim Files: Set Files = fso.GetFolder(EvFileFolderName).Files Dim EvApp: Set EvApp = CreateObject("EchoviewCom.EvApplication") For Each File In Files PickLineFromFile EvFileFolderName & "\" & File.Name Next EvApp.Quit ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Subroutine to pick lines from all ev files in the above folder Sub PickLineFromFile(FileName) If (UCase(Right(FileName, 3)) <> ".EV" Or UCase(Right(FileName, 12)) = " (BACKUP).EV") Then Exit Sub End If Dim EvFile: Set EvFile = EvApp.OpenFile(FileName) If EvFile Is Nothing Then MsgBox "Failed to open EV file '" & FileName & "'" Exit Sub End If PickLine EvFile, "Sv raw pings T1" PickLine EvFile, "Sv raw pings T2" EvFile.Save EvFile.Close End Sub '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Subroutine to pick lines in the above variables then export Sub PickLine(EvFile, VarName) ' Get the variable Dim Var: Set Var = EvFile.Variables.FindByName(VarName) If Var Is Nothing Then MsgBox "Could not find variable" Exit Sub End If Dim VarAc: Set VarAc = Var.AsVariableAcoustic If VarAc Is Nothing Then MsgBox "The variable '" & VarName & "' is not an acoustic variable" Exit Sub End If ' Pick Line Dim Line: Set Line = VarAc.PickLine(VarName & " - Picked Line") If Line Is Nothing Then MsgBox "Line could not be picked. The last scripting log entry may indicate why: " & EvApp.GetLastLogMessage Exit Sub End If ' Export line Dim ExportLineFileName: ExportLineFileName = ExportLineFolderName & "Line pick from " & VarName & " in " & File.Name & ".csv" VarAc.ExportLine Line, ExportLineFileName, -1, -1 End Sub