Running Tasks on the Project Files in parallel

We have developed an application which creates new Trados projects based on a project template and It has Translation Memory and termbase. In the process of creating project, I had to do some jobs called "Running Task on the project Files", I do as help: Running Tasks on the Project Files suggests.

But in SDL Trados Studio,  I can understand from progress bar of tasks that "Apply PerfectMatch" "Pre-translate Files", "Analyze Files" and "Populate Project Translation Memories" are running in parallel , also I see in the help file : FileBasedProject.RunAutomaticTasks():

"This can be more efficient than running tasks individually using RunAutomaticTask( Guid[] , String), because content processing tasks can be executed in parallel"

Every time I substitute the FileBasedProject.RunAutomaticTasks() with individual FileBasedProject.RunAutomaticTask() , it works but the final result is a project without Translation Memory and history of works.

What did I wrong and how should I use FileBasedProject.RunAutomaticTasks()?

  • While "RunAutomaticTask" accepts a SINGLE automatic task identifier (from Sdl.ProjectAutomation.Core.AutomaticTaskTemplateIds enum) as second parameter, "RunAutomaticTasks" accepts ARRAY of those identifiers.

    So you simply build an array of the automatic task identifiers which you want to run and call the "RunAutomaticTasks".

    For example, this is how I build the array in my PowerShell script, depending on whether a "Pretranslate" and/or "Analyze" command line switch was supplied:

            [String[]] $TasksSequence = @()
            if ($Pretranslate) {
                $TasksSequence += [Sdl.ProjectAutomation.Core.AutomaticTaskTemplateIds]::PreTranslateFiles
            }
            if ($Analyze) {
                $TasksSequence += [Sdl.ProjectAutomation.Core.AutomaticTaskTemplateIds]::AnalyzeFiles
            }

    And then I pass the $TaskSequence array to RunAutomaticTask.

    Is this what you are after?

  • Thank you my friend

    I use your answer to call this "RunAutomaticTasks()" with an ARRAY which I create myself.

    Now ,my application is ok.

    .

    I had used this method like this:

       newProject.RunAutomaticTasks(trgFileIDs, TaskSequences.Prepare);

    But now I see in debugger that TaskSequences.Prepare is Null (BUG in SDL Trados 2017 14.0.5889 API).