SDL PowerShell Toolkit

SDL is pleased to announce the availability of a beta version of the SDL PowerShell Toolkit.

The SDL PowerShell Toolkit is a set of modules using Windows PowerShell scripting technology and the Project Automation and Translation Provider APIs from the SDL Trados Studio Professional SDK. In a nutshell, the modules provide functions and sample code that you can re-use in your PowerShell scripts to automate SDL Trados Studio. They feature an initial set of code for use in typical Studio automation tasks such as creating a project, a translation memory or a package derived from a project. You can use these as a starting point for your own PowerShell-based efforts. It is assumed that the reader is familiar with Windows PowerShell as well as an initial understanding of the SDL Trados Studio SDK, in particular the project automation API.

Over time, we would like to see the development community develop further modules and helpful functions that we can share with each other.

Best regards, Ian

Ian Davies | Senior Product Manager | SDL | Language Technologies Division | +44 7826843819

Paul Filkin | RWS

Design your own training!
You've done the courses and still need to go a little further, or still not clear? 
Tell us what you need in our Community Solutions Hub

PowerShellToolkit.zip
Parents Reply Children
  • Hi Luis,

    I have had a go at using the latest set of examples and have successfully analyzed a test file using an existing file based TM. All was going well until I tried to change the analyzeFile setting analyseSettings.ReportInternalFuzzyMatchLeverage.Value = true;

    The issue I have is the innocent looking line:

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

    Powershell does not easily support this type of generic method invocation, I have tried a few web-based ideas out but to no avail. Have you encountered this issue yourself? Any help would be most appreciated.

    This is what I am trying to convert from c# to powershell (taken from API documentation pages)

    public void GetAnalyzeTaskSettings(FileBasedProject project)

    {

       #region "AnalysisTaskSettings"

       ISettingsBundle settings = project.GetSettings();

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

       #endregion

       #region "ReportCrossFileRepetitions"

       analyseSettings.ReportCrossFileRepetitions.Value = true;

       #endregion

       #region "ReportInternalFuzzyMatchLeverage"

       analyseSettings.ReportInternalFuzzyMatchLeverage.Value = true;

       #endregion

       #region "ExportFrequentSettings"

       analyseSettings.ExportFrequentSegments.Value = true;

       analyseSettings.FrequentSegmentsNoOfOccurrences.Value = 5;

       #endregion

       #region "ExportUnknownSegments"

       analyseSettings.ExportUnknownSegments.Value = true;

       analyseSettings.UnknownSegmentsMaximumMatchValue.Value = 50;

       #endregion

       #region "UpdateAnalyzeSettings"

       project.UpdateSettings(settings);

       #endregion

    }

  • Thanks Patrik. I got it working by using add-type -language CSharp

  • Hi Patrik

    I need a little help with this... Got a nice little script that will automate package-generation, but: it always fails with "license check failed, with Exception Sdl.Core.FileCheck.FileCheckException: Unknown Error"

    The error occurs at "CheckLicense() => LicenceCheckWithoutUsingNetworkSeat.get_License" when doing a Get-Project. This doesn't quite make sense as we do have license server in the network, and Studio itself is working.

    How I can I get this going?

    TIA

    Markus

  • Hi,

    are you running it as 32 or 64 bit?

    Studio is 32 bit only and some of the licensing components will fail if you run as 64 bit.

    Regards

    Patrik

  • Hi

    I'm running 64bit, but I'm launching powershell in 32bit-mode. The problem was intermittent, after a reboot it's mostly gone... Very strange.

    Off to the next challenge ;)

    I'm now successfully creating a packagee from a project, but I need to include the analysis-reports for the target-language.

    Any hints on how to enable this? Or do I have to manually copy the reports into the resulting sdlppx (zip)?

    Thanks a lot for your help.

    Markus

  • Hi

    OK, I also got around this, sort of.

    Next, bigger issue:

    I want to have new project-TMs created upon package creation, hence I set:

    $packageOptions.ProjectTranslationMemoryOptions = [Sdl.ProjectAutomation.Core.ProjectTranslationMemoryPackageOptions]::CreateNew;

    However, as soon as this option is enabled, I don't get any project-translation-memories at all.

    The parameter itself is valid and should work, since setting it to "UseExisting" results in attached project-TMs (most of the time), so it's got to be some hidden magic?

    If somebody could shed some light on this issue, I'd be very grateful.

    Best regards

    Markus

  • Hi

    I'm working on project creation.

    I've been able to get translation memories objects from my server, and i've been able to create a filebased project.

    What I need to do is to create a filebased project with server-based TMs. I couldn't find anything in the examples provided and seems the modules just manage filebased tms.

    I've tried to modify the existing modules in several ways but so far i couldn't get it to work right. I'm still learning the environment and seems i'm not skilled enough to do that.

    Any help from this community?

    Thank you very much in advance...

    Enrico

  • Hi Enrico

    I suppose you've already given the TMServerHelper.zip from Luis Lopes in post #4 a try, and your problem is now that the "New-Project" cmdlet only takes a path to a TM as a parameter?

    Judging from this entry in the API documentation, you should be able to rewrite it to take a Uri as param "$pathToTMs" instead of a string, and you should be fine.

    Good luck
    Markus

    P.S.: There doesn't seem to be a lot of activity here, unfortunately, so don't expect to get answers fast.

  • Hi Markus,

    I gave it a try and yes, the issue is kinda that (there's a function to get the target language from a memory filepath inside the projecthelper that's not "server-ready").

    The page you pointed me at should anyway be helpful. I'll try to apply it and post my results.

    Is there any "update" i should issue after modifying a module? Or it should just take any modification right-away? (I mean specifically changing arguments of a function)

    Thank you very much!

    Enrico

    PS: I'm lucky: I got a very fast answer ;-)