Search & replace multiple words/terms in pre-translated segments?

I often find myself doing multiple search & replace of the same words again and again in pre-translated segments and I'm thinking there's got to be a way to automate that somewhow, perhaps using a script. Any ideas?

emoji
Parents Reply Children
  •  

    What are the paths to your files?

    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
  • The script file, settings file and replacements file are all in C:\AHK scripts\

    emoji
  •  

    File names?

    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
  • Dropdown_Search_Replace.ahk
    settings.txt
    CFM_replacements.txt

    emoji
  •  

    Also what version of Trados Studio and what operating system.

    Gives you some idea of just how much error handling the development team need to put into every single small thing they build!!  Also explains whey it always works on "my computer"!

    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
  • Trados Studio 2022 SR1 - 17.1.6.16252
    Windows 11 Home 10.0.2261 Build 22621

    Can it have something to do with where my trados files are located? Again, I can see the S&R box cycling through all the replacements in my replacement file, but nothing gets changed in the target column. Looks like we're very close, but...

    emoji
  •   

    I tried to replicate your setup as follows... all good:

    However...

    1. I don't have W11.  ChatGPT says this:
      "There aren't any inherent changes in Windows 11 that would directly impact the functionality of AutoHotkey scripts compared to Windows 10. However, there might be changes in user interface or system behaviors in Windows 11 that could affect the behavior of your script, especially if it relies on interacting with specific applications or parts of the Windows interface.  For instance, if an application's controls have changed (names, positions, etc.) in the new version of the OS, the script might fail to interact with them as expected. This might be relevant for your script, since it involves interacting with Trados Studio."

    2. I don't know what version of AHK you're running, I have 1.1.33.10.  You can use this single line script to get that:
      MsgBox % "AutoHotkey version: " . A_AhkVersion

    3. I don't know what your replacement file looks like... and empty rows, additional lines at the end or start?

    On point 1. I guess you could check the labelling I used for the search, replace and replace all button using AHK's Window Spy?  I used these:

    Edit2
    Edit1
    WindowsForms10.BUTTON.app.0.ea119_r8_ad19

    In that order.  I can't think why these would change, but probably worth checking.

    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
  •  

    I also checked with ChatGPT as it's smarter than me...

    It could be due to several reasons:

    1. **Differences in the setup**: Check if all file paths and file contents are correct and match what the script expects. This includes the path to the settings file and the search and replace files mentioned in the settings file.

    2. **Permissions**: Ensure that the script has the necessary permissions to read the files. If the files are in a protected directory or if there are user-specific restrictions, the script might fail to read the files. Try running the script as an administrator.

    3. **Differences in software versions**: Even if the version of SDL Trados Studio is the same, differences in other software versions (like Windows or AutoHotkey itself) might cause different behavior. If possible, try to use the same versions of all relevant software.

    4. **Differences in system settings**: For example, if the target system is using a different display scaling setting, it might affect the coordinates used by the script for GUI positioning and clicks.

    5. **Differences in Windows versions**: As I mentioned in the previous message, there might be changes in user interface or system behaviors in Windows 11 that could affect the behavior of your script.

    6. **Script Execution**: Make sure that the script is properly started (as an administrator, if necessary) and that the hotkey is pressed in the right context.

    If the problem persists, try debugging the script by adding message boxes (`MsgBox`) at various points in the script to check if the script is running as expected and to identify where it might fail. Also, try to see if there are any error messages or if the script is exiting prematurely.

    If it's only the search and replace functionality that's not working, make sure the search terms in the selected file exactly match the text in SDL Trados Studio (considering case sensitivity, white spaces, special characters etc.). Also, ensure the control names (`Edit2`, `Edit1`, `WindowsForms10.BUTTON.app.0.ea119_r8_ad19`) in the script are still valid in the other user's SDL Trados Studio.

    Remember to always back up your data before running scripts that modify it, especially when debugging.

    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
  • Hmmm... I just upgraded to the latest version of AHK (2.0) to see if it would make any difference. It doesn't. My replacements file is very simple. For testing purposes it only has this:

    Cybertip Cyberaide
    C3P CCPE
    Project Arachnid Projet Arachnid

    All separated by tabs. I even get your "Operation complete" message at the end, but again, nothing gets changed in the target column even though it does contain segments with the words "Cybertip", "C3P" and "Project Arachnid".

    emoji
  •  

    Maybe a more basic problem... do you have anything else different in your search & replace window to the settings I used?

    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