Saving/Restoring user defined string filters

Hello,

I created a C# tool for automation of our Passolo related workflows. For the automated translation process we need some specific/different Passolo settings (options).

Therefore...

1) When the tool starts I save all current Passolo setting via COM instruction objPSL.Option[-number].

2) Then I change some settings that are required for the translation process.

3) Before the tool ends I restore the formerly saved settings to have Passolo in the same state as before.

Unfortunately, there seems to be no possibility to save/restore existing user defined string filters via COM instructions.

The only workaround I have found so far is to save the user defined string filters in a separate .pslopt file via the export options dialogue (but that is a manual process step I want to avoid) and then to import the filter settings via COM instruction objPSL.ImportOptions[file name] again.

I know there exists a BATCH instruction for saving all options (including user defined string filters), but I want to avoid calling batch instructions inside the C# code.

Apart from that the .pslopt file is not always properly saved using the batch command.

Is there any possibility to save/restore user defined string filters via COM command?

emoji
Parents Reply Children
  • Ah ok, I had to look at C:\Users\<username>\AppData\Roaming\SDL\Passolo 2018. We still use Passolo 2018. The 2022 folder contains data from the BETA version I tested last year. Apparently data is still saved there, even though I had uninstalled the 2022 version.

    The filters.dat actually contains the test filters I created. If it's possible to load the filters via COM command obj.ImportOptions() it would be exactly what we need.

    I try to implement the use of filters.dat in my code asap. Many thanks for your help!

    emoji
  • After some tests I found a final solution for the filter issue. 

    1) When the tool starts I need to make a copy of filters.dat.

    2) Exchange suffix .dat by .pslopt.

    3) Insert the first 4 lines of a typical options file in front of the filter definitions to create a valid options file.

    When importing the Passolo settings required for automation process from a separate options file, existing user defined filter settings get lost.

    4) Before the tool ends I import the formerly saved filter definitions via COM command objPSL.ImportOptions(.../filters.pslopt).

    So all in all it's relatively easy to implement.

    Thanks again for your really valuable tip about the filter.dat file!

    First few lines of filter.pslopt (inserted lines from another .pslopt file highlighted):

    Screenshot of a Trados Studio filters.pslopt file with inserted lines highlighted, showing content, options, version, and string filter sections.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 10:34 AM (GMT 0) on 4 Mar 2024]
  • For a final solution I had to add two additional process steps.

    1) I noticed that project filter settings get also lost. Project filter settings are automatically stored by Passolo in file prjfilters.dat in the same folder as filters.dat. Therefore it's required to make also a copy of prjfilters.dat when the tool starts and then create a filters.opt file that contains both string and project filter settings.

    2) I also noticed that I need to explicitely encode the filter setting texts to USC-2 LE-BOM (UTF-16) when storing them in filters.opt file. Otherwise German umlauts get lost when importing filters.opt file again and lead to ugly texts in the filter dialogues.

    These two steps were also fairly simple to implement. Now everything work as desired.

    emoji