Forum Discussion

SuperTester's avatar
SuperTester
Contributor
4 years ago
Solved

Add Existing Items to Regions - Adding Underscore

Hey guys,

I'm trying to add regions from one project to another. I'm using the Add New item wizard and I noticed that after I added the image, I noticed that Test Complete added an _png to the image name. Is there a way to add images to Regions without the underscore? It would be tedious to have to remove it with each image added.

 

Screenshot:

 

Side note: I'm guessing that Test Complete adds the _png because it converts Region images in png format?

 

Thanks in advance!

 

  • Hello,

     

    Its just a matter of inconvenience is all. I have some 60 -100 images to transfer between projects and wanted to check if there is a "smarter not harder" approach to correcting their names.

     

    Thanks

5 Replies

  • tphillips's avatar
    tphillips
    Frequent Contributor

    I am not sure if you can control what the file is saved as, but is it such a problem if there's a "_png" on the end?

     

    You could write a script to go through your files and region store entries to remove the "_png" from them, if it bothers you that much.

    • SuperTester's avatar
      SuperTester
      Contributor

      Hello,

       

      Its just a matter of inconvenience is all. I have some 60 -100 images to transfer between projects and wanted to check if there is a "smarter not harder" approach to correcting their names.

       

      Thanks

  • anupamchampati's avatar
    anupamchampati
    Frequent Contributor

    To the surprise there is no direct way it seems to do that.

    But you can do below things to quickly change things

    1.  Add all the files in the new project

    2. Go to {project}\Stores\Regions.tcRegions 
    3. Edit the file in any editor (I used notepad++)

    4. Search for _png and replace with "" blank space

    5. Save the file and TestComplete will ask to refresh and once you do , all the files will have _ underscore removed

     

    As the file location will use .png so search and replace will only change the _png from name and caption name field.

    Hopefully it will help you to quickly use the same code across without underscore.

    • SuperTester's avatar
      SuperTester
      Contributor

      Hey,

       

      Thank you for the suggestion! Quick clarification, when using Notepad++ to edit a file, how do you specify a file?

       

      I'm trying to use Notepad++'s Find in Files feature accessed via Search > Find in Files and it only lets me point to a folder. Not a specific file.

       

       

      Thanks!

       

      • anupamchampati's avatar
        anupamchampati
        Frequent Contributor

        Approach 1 : Directly say File >> Open in Notepad++ and browse the file

         

         

        Approach 2: Just browse in the Stores folder using Window explorer and Right Click on the File  >> Edit in Notepad++ or directly drag and drop the file into Notepad++