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 Group

________________________
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 Sinan,

    The powershell toolkit has not been updated for over 6 years....
    I mean, the original code points to Trados 2011...
    github.com/.../TMHelper.psm1

    The error your are getting "cannot find an overload" is trying to call a method which no longer exists in newer versions of Trados Studio. (IIRC that overload existed until Trados Studio 2014).

    Long story short, it badly needs updating, but no one takes the time to do it :).
  • As Jesse says, the toolkit was created for older Studio version which uses only 4 parameters for creation of filebased TM.

    I changed my toolkit modules to accept $StudioVersion as parameter (which is simply the variable part of Studio program files path)

    param([String]$StudioVersion = "Studio4")

    if ("${Env:ProgramFiles(x86)}")
    {
        $ProgramFilesDir = "${Env:ProgramFiles(x86)}"
    }
    else
    {
        $ProgramFilesDir = "${Env:ProgramFiles}"
    }

    Add-Type -Path "$ProgramFilesDir\SDL\SDL Trados Studio\$StudioVersion\Sdl.LanguagePlatform.TranslationMemoryApi.dll"
    Add-Type -Path "$ProgramFilesDir\SDL\SDL Trados Studio\$StudioVersion\Sdl.LanguagePlatform.TranslationMemory.dll"

    and then use it to differentiate the TM creation calls

        if ($StudioVersion -le "Studio3")
        {
            $TM = New-Object Sdl.LanguagePlatform.TranslationMemoryApi.FileBasedTranslationMemory ($TMPath, $Description, $TMSourceLanguage, $TMTargetLanguage, $FuzzyIndexes, $Recognizers)
        }
        else
        {
            $TM = New-Object Sdl.LanguagePlatform.TranslationMemoryApi.FileBasedTranslationMemory ($TMPath, $Description, $TMSourceLanguage, $TMTargetLanguage, $FuzzyIndexes, $Recognizers, $TokenizerFlags, $WordCountFlags)
        }


    In other words, newer Studio versions need 6 parameters when creating filebased TM (that's why the error message states the number 6 ;-) ).

    I may eventually publish my heavily changed toolkit on GitHub, but it's still lacking some TM-related updates... and I don't have much time to finish that :-\.

  • Oh, but the second error may be a showstopper - you need Professional license in order to be able to use the Project Automation API.

    So if you don't have that, don't even bother digging deeper into PowerShell Toolkit...