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
  • Hello,

    I just wanted to try this toolkit on my pc but I could not do it right. I get below error.

    Can you tell me what is wrong?

  • 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 :-\.

Reply
  • 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 :-\.

Children
No Data