Trados Studio 2021 - Count number of segments in Files

Dear all, 

we are using Trados Studio 2021 and file-based projects with several source files.

We sometimes need to count and output the number of segments for each source file (just after the project has been created).

I have found the following workaround.

Assumptions: (1) the Analyze Files batch task has been run on the project and (2) all relevant files are open together in the Editor (by means of "virtual merge").

Using the EditorController, it is possible to get the segment count from AnalysisStatistics for each file. 

foreach (var f in activeDoc.Files)
  if (f.AnalysisStatistics.AnalysisStatus == ValueStatus.Complete)
    int segmentCount = f.AnalysisStatistics.Total.Segments;

I was wondering, though, whether there is a better way to achieve the same without opening the files (e.g. by means of the ProjectsController) and/or without having to perform the analysis.

Thank you for your interest.

Parents Reply Children
No Data