Is there any way of addressing the project list in Trados Studio?

Hi all,

I was wondering if it's possible to read values from the project list with AutoHotkey. In particular, when working with WorldServer packages, I am so sick of Studio always defaulting to the last used target directory when I export a package. So I'm desperately trying to create a script that can read the location of the selected project in the list. Any help or hints would be much appreciated.

Thanks,
Stefan

emoji
Parents
  •   

    I was wondering if it's possible to read values from the project list with AutoHotkey.

    I'm afraid it's probably not.  I had a quick play to see if I could find a way but my limited knowledge of AHK didn't get me any fruitful results. It could be that a complex custom control like the ones in Studio don't expose their child controls to standard Windows messages, which AutoHotkey relies on to fetch such information.  I tried to use a script o see if I could get at the child controls that might contain what I needed but this wasn't really helpful and all I got back was this:

    Fullscreen
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Nothing I could use to pull a project location.

    The API does support this of course but if you don't have the Professional version you won't be licensed to use it so you'd need someone else to develop a plugin you could use.  So not very helpful for you.

    I am so sick of Studio always defaulting to the last used target directory when I export a package.

    I would be interested to know a bit more about this though?  I can't get this to go anywhere other than the location of the project the package was created in.  Can you explain exactly your process here and at what point you find this problem?  Also what version of Trados Studio?

    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

    emoji
  • Hi Paul,

    Thanks for your reply and your effort. I do have Studio 2021 Professional.

    My problem is that Studio does NOT default to the folder where the package was created in, but to the folder I exported my last project to. (Where "created" is the wrong term. WS packages are actually created online by WS and I can only download the package from there.)

    Scenario:
    1. Download WS Packages 1, 2 and 3.
    2. Import WS Packages 1, 2 and 3 into Studio as Projects 1, 2 and 3. (No way to create projects containing multiple packages, but that's another story.)
    3. Complete translation of Project 1, export Project 1 from Studio to a folder of my choice.
    4. Complete translation of Project 2, export Project 2 from Studio to another folder.

    And the problem is in step 4: Studio will default to the target path that was used for Project 1.

    Although Studio "knows" where the project to be exported resides, it does use the target path of the project that was exported before. This requires me to always click the Browse button and navigate to the correct folder. Unfortunately, exporting all WS packages to the same folder is not an option for me, because I get packages for too many clients, divisions and subdividions, so I would end up in a mess very quickly.

    Best regards,
    Stefan

    emoji
  • ,

    So you need the path to the active project in Trados Studio, right?

    If so, I think I can make it. I don’t know much about WS projects, I guess they are handled the same way as usual projects. So the AutoHotkey script can copy the path to the clipboard and you an paste it somewhere, would that be OK?

    emoji
  • Hi Jesús,

    Thank you so much for your reply. Any hint on how to read the path of the active project would be excellent, yes. But please do not put in too much effort, just pointing me in the right direction would be absolutely fantastic.

    Thanks a lot in advance,
    Stefan

    emoji
  •  

    The active project can be known by AutoHotkey in any view because it’s in the title bar of Trados Studio:

    WinGetTitle, myProject, A

    And remove the Trados Studio leading part:

    pos := InStr(myProject, "-") ; Remove left part = "(SDL) Trados Studio - "
    myProject := SubStr(myProject, pos+2) ; 2 positions to the right (hyphen + space)

    Then, you need to open the file projects.xml in read-only mode and have its content in a text variable.

    myXML := "C:\Users\[YourUserNameHere]\Documents\Studio 2022\Projects\projects.xml"

    FileEncoding, UTF-8

    FileRead, content, %myXML%

    That was the easiest part!

    Now you need to loop through the ProjectListItem elements in the variable content and ensure that the project name (Attribute Name) is the one saved in the variable myProject in the first step. When it is, get the path to that project (attribute ProjectFilePath). And that’s it! I’d do it using regexes but XML will make it too.

    emoji
  •  

    The active project can be known by AutoHotkey in any view because it’s in the title bar of Trados Studio:

    WinGetTitle, myProject, A

    Clever thinking!!

    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

    emoji
  • Hi Jesús,

    Thank you so much for your reply.
    I somehow was afraid that reading the project xml is the only way to read paths. That's why I asked if the list of projects in the Projects view can somehow be addressed.
    I was hoping to be able to export several projects at once with AutoHotkey, but this requires reading the list, because there can only be one active project at a time...

    emoji
Reply
  • Hi Jesús,

    Thank you so much for your reply.
    I somehow was afraid that reading the project xml is the only way to read paths. That's why I asked if the list of projects in the Projects view can somehow be addressed.
    I was hoping to be able to export several projects at once with AutoHotkey, but this requires reading the list, because there can only be one active project at a time...

    emoji
Children
  • ,

    I’ve never tried to get the project names selected in the Projects view. I've tried to do it now and I can’t.

    With AutoHotkey you can get the text just below the mouse, and it doesn’t work either in the Projects view, but it works in the Manager (Beta) view. Obviusly at any time there is only one single project below the mouse, which maybe quicker anyway than activating a project in the Projects view. If you are interested in this unusual way to grab the text below the mouse, details are explained in this video https://www.youtube.com/watch?v=FUXQI3x8AzY and a sample script can be downloaded as well.

    emoji
  • Hi Jesús,

    Thanks a lot for your reply. I have clients that keep sending handoffs comprising many, many (current record is 121(!)) WorldServer projects. Unfortunately, Studio does not allow importing or exporting more than one project at a time, so I had a tiny hope that some script magic could work around this shortcoming. But I guess I have to live with exporting each project one by one...

    emoji