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
  • Rotten thread, I know... but anyway...

    I started playing with the PowerShell Tookit, modified the modules to accept the Studio path (Studio2, Studio3, etc.) as argument, so that I can easily play with different installed Studio versions... Still playing only with the Sample_RoundTrip script, though...

    But I'm struggling with the filetypes known to the API-created project, in particular a MemoQ XLIFF.

    According to the API documentation, method used by PowerShell Toolkit for creation of new project "creates a new project based on the default project template set up in SDL Trados Studio. "

    But... while Studio 2015 recognizes a *.mqxliff file - apparently because it's included by default, no need to Install File Type from OpenExchange - and produces correct analysis stats, Studio 2014 does not and spits out only zeroes... and I don't understand why, since my Studio 2014 default project template DOES include MemoQ XLIFF file type!

    Even if I create a copy of my default project template as "Default" profile - just in case the API uses the "Default" profile instead a default profile - it still does not work.

    Where is the catch?

  • Unknown said:

    According to the API documentation, method used by PowerShell Toolkit for creation of new project "creates a new project based on the default project template set up in SDL Trados Studio."

    But... while Studio 2015 recognizes a *.mqxliff file - apparently because it's included by default, no need to Install File Type from OpenExchange - and produces correct analysis stats, Studio 2014 does not and spits out only zeroes... and I don't understand why, since my Studio 2014 default project template DOES include MemoQ XLIFF file type!

    Quoting myself since this problem was not solved the first time and I'm seeing it again, this time with Studio 2015 SR2 and Excel file.

    My default template (and also the setting in Studio Options) is changed to NOT translate Excel worksheet names (in Excel 2007-2013 file type definition).

    Still, project created using API (using the Powershell Toolkit) ignores completely this setting and DOES include worksheet names...
    In other words, it looks like the project was created using some 'hardcoded default' settings (those which Studio uses when it's run the very first time and creates the default template) instead of using the default template settings.

    Why?! And how do I make it work as expected, i.e. as documented?!

  • Hahaha, found the reason... apparently it does NOT work as documented :(... or the documentation is incorrect :(

    The project is not based on "default project template set up in SDL Trados Studio", but it's based on "Default.sdltpl" present in "<Documents>\Studio 2015\Project Templates" directory.
    If that file is not present, project creation via API fails big time :( ... at least using the Powershell Toolkit.

    New-Object : Exception calling ".ctor" with "1" argument(s): "Could not find the default project template. Run SDL Trados Studio to initialize the default project template."At D:\Documents\WindowsPowerShell\ Modules\ProjectHelper\ProjectHelper.psm1:107 char:22
    +     $FileBasedProject = New-Object Sdl.ProjectAutomation.FileBased.FileBasedProject ...
    +                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
        + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand

    The referred PS line says:

    $FileBasedProject = New-Object Sdl.ProjectAutomation.FileBased.FileBasedProject $ProjectInfo

    The point is that "default project template set up in SDL Trados Studio" is NOT stored in "Default.sdltpl" file, but e.g. in "SDL Trados.sdltpl", depending on which option user used during the Studio first run setup.

    Looking forward to some official SDL statement...

    EDIT:
    Before someone starts asking - all settings in my user profile, etc. are correct and point to the "SDL Trados.sdltpl" template file...
    Isn't this again about "not providing the needed context" like in the case of the annoying log4net message?

  • Can anyone comment on that?
    Is that a Studio (API) bug? Or incorrect documentation? Or something else?
  • First of all you are right the default behavior in the API has nothing to do with Powershell Toolkit. Your implementation for discovering the current default template is really good and reliable since it's pretty much what Studio does at the "UI" level.

    Now to clarify a bit the default "mistery" in the Project Automation API. The documentation says the constructor will use the default template, the information that is unclear is that it will use the default template configured in the current configured user profile. Most of the times this is the Default user profile which is based on the default project template. It would make more sense to use the current default project template persisted in the user settings so I will raise this change with the development.

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

Reply
  • First of all you are right the default behavior in the API has nothing to do with Powershell Toolkit. Your implementation for discovering the current default template is really good and reliable since it's pretty much what Studio does at the "UI" level.

    Now to clarify a bit the default "mistery" in the Project Automation API. The documentation says the constructor will use the default template, the information that is unclear is that it will use the default template configured in the current configured user profile. Most of the times this is the Default user profile which is based on the default project template. It would make more sense to use the current default project template persisted in the user settings so I will raise this change with the development.

    Romulus Crisan | Translation Productivity Development Manager | SDL | (twitter) @cromica_82 | (blog) http://www.romuluscrisan.com/

Children
  • Hi Romulus,

    my offline documentation says pretty clearly this:

    FileBasedProject Constructor (ProjectInfo)
    Creates a new project based on the default project template set up in SDL Trados Studio.
    ...
    Remarks
    The default project template has to be set up before you can use this constructor. This is done automatically when SDL Trados Studio starts for the first time after installation.

    And that's actually the ONLY thing which makes sense - that if I select the "Trados" profile during the first run after installation, this (and only this) template will be used as default... just as Studio does "at the UI level".
    Any other behavior does not make any sense since it would be inconsistent with the "UI level behavior" and different than documented.