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

Children
  • 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 ;-)

  • Hi Enrico

    Well, you got a fast answer, but it's just from another lost soul in the SDL SDK space ;)

    From what I've learned so far, you should restart your application to make sure the updated modules are loaded.

    Depending on when you load the modules, that may not even be necessary. Ex: I have written a small application with a drag'n'drop window, that let's you create a package by dropping a .proj file in it; when the module loading/unloading happens on-event, it will reload the modules on every file dropped. For efficiency's sake I rewrote it later to only load/unload the modules on start/stop of the entire application.

    Best regards

    Markus

  • Yeah it worked! you don't know how happy I am ;-). Thank you Markus for the hint. It pointed me to the right direction!

    As for changes the module while developing, you just have to use the "-force" option in import-module and it will get reimported every time with the modifications to the .psm1 file.

    I wrote a little web-broker connected to powershell in order to interface it to our in-house management system.

  • Hi Markus,

    were you able to identify the magic behind the $packageOptions.ProjectTranslationMemoryOptions = [Sdl.ProjectAutomation.Core.ProjectTranslationMemoryPackageOptions]::CreateNew;

    Even though I make sure to save the project before creating the new packages, I get an "<Messages Level="Warning" Message="No main translation memories found to create project translation memories from for language pair English (United States)->Korean (Korea)." Source="Populate Project Translation Memories" />" inside the sdlppx's sdlproj file.

    Even the "UseExisting" is not working for me, there are just no TMs in the packages.

    Regards,

    Jan

  • Well, about those Project TMs in packages: could you please try setting TranslationProviderConfiguration.OverrideParent to true?

    Seems to be working for me :-)

    Jan

  • Hi Jan

    What I found out so far:

    CreateNew seems to work only if you have $packageOptions.RecomputeAnalysisStatistics = $true;.

    Then again, I had error messages about "could not create instance of translation provider sdltm.https://...." which in turn happens because the integrated Windows-auth does not work with providers in that format "sdltm.https://....", it seems the "sdltm." has to be removed.

    I resolved that by adding a local SDL-user on our server which is added in the script through

    $project.Credentials.AddCredential("sdltm.https://<URI>:443",$false,"user","pass");

    After opening the project-File, of course.

    In short: you have to work around a lot of quirks in those libs, it seems...

    Regards
    Markus

  • Hello, still writing here, although I suspect this hasn't much to do with powershell, but with updated SP2 API.

    Since I upgraded to SP2, projects with file-based TM comes out without any TM configured. I tried using the original example provided but with the same result as my code.

    Projects with server-based TM gets configured correctly. This line:

    $entry = New-Object Sdl.ProjectAutomation.Core.TranslationProviderCascadeEntry ($tmPath, $true, $true, $true);

    gives me an empty object wether $tmPath is a Correct path string or a Translation Provider Reference as per this page:

    producthelp.sdl.com/.../Index.aspx

    Should I install an updated SDK? Is there any release Notes about API in SP2?

    Thank you!

  • Unknown said:

    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.

    Has this ever been clarified/solved? I'm now having exactly the same problem...

    I got the new project TMs being created only if I also set the "IncludeReports" option (newly introduced in Studio 2015 CU7) to True.

    It seems to me like if this option doesn't control only including reports, but rather works as a global "DO include / DON'T include stuff" switch... which would point to either incorrectly documented API, or incorrectly working API.

    Anyone can comment on this?