AnalyzeFiles and PreTranslateFilesTasks inProject Automation API Ignore Server TMs.

Hi,

I have managed to create an application using the the Project Automation API that creates a Project based on the needed info (source and target languages , source files, Server TMs to be used, Project settings etc.).  After much struggle, guesswork and trial and error I have managed to properly generate the Project.  When opened in Studio all is there.  The source files, the target files, the TMs with the correct settings etc.

I also run the relevant Analysis and Pretranslation tasks.  The relevant actions are performed without errors and the relevant reports are generated.  However, the reports do not include or use any of the project TMs and the generated reports only mention repetitions and internal fuzzy matching.

If one opens the Project in Studio (without changing anything) and runs an Analysis the new reports use the TMs and provide correct analysis results.

The relevant Analysis code is :

WriteText("Analysing Target Files...");

#region Get Analyse Settings

ISettingsBundle settings = Proj.GetSettings();

AnalysisTaskSettings analyzeSettings = settings.GetSettingsGroup<AnalysisTaskSettings>();

#endregion

#region Set Internal Fuzzy Matching Value

if (InternalFuzzies.ToLower() == "true") analyzeSettings.ReportInternalFuzzyMatchLeverage.Value = true;
else analyzeSettings.ReportInternalFuzzyMatchLeverage.Value = false;

#endregion

#region Set Cross Files Repetitions Value

analyzeSettings.ReportCrossFileRepetitions.Value = true;

#endregion

#region Update Settings

Proj.UpdateSettings(settings);

#endregion

CSVOpen();

for (int i = 0; i < LangTrgLangs.Length; i++)
{
Language LangTrgLang = LangTrgLangsIdea;

WriteText("Analysing Target Files for " + LangTrgLang.DisplayName);

#region Analyse Language Pair

ProjectFile[] TargetFiles = Proj.GetTargetLanguageFiles(LangTrgLang);

AutomaticTask analyzeTask = Proj.RunAutomaticTask(TargetFiles.GetIds(), AutomaticTaskTemplateIds.AnalyzeFiles);

CheckEvents(taskStatusEventArgsList, messageEventArgsList);
if (!Continue) WriteError("Failed to Analyse files.", "Please check and try to analyse them manually.");

#endregion

#region Save Analysis Report for Language Pair

WriteText("Saving Analysis Html Report File for " + LangTrgLang.DisplayName);

Guid reportId = analyzeTask.Reports[0].Id;
string AnalysisFileName = JobFile.Substring(0, JobFile.Length - 4) + "_" + LangTrgLang.DisplayName + ".html";
Proj.SaveTaskReportAs(reportId, AnalysisFileName, Sdl.ProjectAutomation.Core.ReportFormat.Html);

#endregion

Any help in the matter would be greatly appreciated.  I have spend a couple of days on it and no matter what I have tried I did not manage to make it work properly.

Thank you in advance for any tips or help.

Best regards,

Costas

also uses them in trhe Analysis.