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:

    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad11	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad12	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad13	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad14	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad15	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad16	Content: 
    Control ID: HwndWrapper[SDLTradosStudio.exe;;eb42c76b-5449-43d7-b8dc-529aba2d60fb]1	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad17	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad18	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad19	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad110	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad111	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad112	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad113	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad114	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad115	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad116	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad117	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad118	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad119	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad120	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad121	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad122	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad123	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad124	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad125	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad126	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad127	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad128	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad129	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad130	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad131	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad132	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad133	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad134	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad135	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad136	Content: 
    Control ID: HwndWrapper[SDLTradosStudio.exe;;3cef14c8-0ac0-4e10-9ebf-ee704b6ff225]1	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad137	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad138	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad139	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad140	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad141	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad142	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad143	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad144	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad145	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad146	Content: ultraGrid1
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad147	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad148	Content: 
    Control ID: WindowsForms10.STATIC.app.0.ea119_r9_ad11	Content: Select a single project in order to view the details.
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad149	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad150	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad151	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad152	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad153	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad154	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad155	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad156	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad157	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad158	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad159	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad160	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad161	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad162	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad163	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad164	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad165	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad166	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad167	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad168	Content: 
    Control ID: WindowsForms10.Window.8.app.0.ea119_r9_ad169	Content: 

    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 Children