Rename Source/Target Files in a Project

Hi

Passolo 2018 Team Edition question.

I have an automation question using C# and COM

I have a bunch of projects which contain files that live in folders with names containing for example 2025Q1.

When I perform a translation outsource at the moment, I manually open each project and change the names of the source folders and target folders to the new year/quarter. e.g., change the project folders from 2025Q1 to 2025Q2

I'd like to automate via a C# COM program but cannot seem to find the way to do it.

I've tried this code, but whilst it does not give an error, neither does it rename the output files in my project. when done.

Can this be done?
Best regards

Mark

            PassoloApp passolo = new PassoloApp();
            // Open the project
            passolo.Projects.Open(projectname, 36);
            sourcelists = passolo.ActiveProject.SourceLists;
            for (int i = 1; i <= sourcelists.Count; i++)
            {
                sourcelist = sourcelists.Item(i);
                if (sourcelist.SourceFile.Contains(oldquarter))
                {                // Update the source file path if needed
                    Console.Write("Rename {0} to ", sourcelist.SourceFile);
                    sourcelist.SourceFile = sourcelist.SourceFile.Replace(oldquarter, newquarter);
                    Console.WriteLine("{0} ", sourcelist.SourceFile);
                    sourcelist.Save();
                }
            }

emoji
Parents
  • Before starting to analyze your code and reproduce potentials problems, I would like to ask why this should be automated? If the paths have to be changed every quarter, it is probably not really worth the effort of a macro. There is a simple function to adjust the paths in a project.

    In the project view, go to the tree view on the left side and open the Folders node. Here you can right-click a sub-folder name and select Change Folder.

    Project view of Multilingual Notepad 2022 showing string lists, sources, targets, and folders with a Change Folder dialog open for path modification.

    This will do the job in some seconds.

    Without testing your code, it might be necessary to call PslProject.Close at the end of the code.

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 9:21 AM (GMT 1) on 10 Jul 2025]
Reply
  • Before starting to analyze your code and reproduce potentials problems, I would like to ask why this should be automated? If the paths have to be changed every quarter, it is probably not really worth the effort of a macro. There is a simple function to adjust the paths in a project.

    In the project view, go to the tree view on the left side and open the Folders node. Here you can right-click a sub-folder name and select Change Folder.

    Project view of Multilingual Notepad 2022 showing string lists, sources, targets, and folders with a Change Folder dialog open for path modification.

    This will do the job in some seconds.

    Without testing your code, it might be necessary to call PslProject.Close at the end of the code.

    emoji


    Generated Image Alt-Text
    [edited by: RWS Community AI at 9:21 AM (GMT 1) on 10 Jul 2025]
Children
No Data