Skip to main content
Participant
July 17, 2025
Question

New swatch with the incremental number is added after find/change text between different files

  • July 17, 2025
  • 3 replies
  • 363 views

I have two InDesign files: a.indd and b.indd. Each of these files has a swatch named "red", with the same name but different CMYK values.

Steps to reproduce the issue (this problem occurs in all Mac versions of InDesign, Windows version is unknown).

  1. In a.indd, open the Find/Change window and enter some text to find, for example: "test".
  2. In the "Change Format" section, choose to change the character color to the "red" swatch.
  3. Execute the change.

Up to this point, everything works normally.

Next, open b.indd and repeat steps 1-3. This time, when you select the color swatch, an incremental number (starting from 2) appears after the color name (e.g., "red 2"). After executing the change, new swatches with these incremented names (e.g., "red 2", "red 3",...) are added to the Swatches panel.

※ If you quit and restart the InDesign application before performing the operation in b.indd, this problem does not occur.

Is this a bug?

3 replies

rob day
Community Expert
Community Expert
July 17, 2025

Hi @john-9874 , I can’t tell from your capture, but what is your Search scope? Is it All Documents? That might cause a conflict between the same named "red" Swatches with different CMYK values.

john-9874Author
Participant
July 18, 2025

Thanks @rob day . The search scope is : document.  Not all documents

And, I closed the a.indd file before performing the same search-and-replace operation on the b.indd file.

Abhishek Rao
Community Manager
Community Manager
July 17, 2025

Hi @john-9874,

 

Thanks a lot for the detailed explanation and for already testing with IDML versions.

To look into this further with the team, could you please confirm the details of your operating system? Also, if possible, it would be great if you could share a quick screen recording showing the exact steps you're following, from using Find/Change in file a.indd to switching to b.indd and when the swatch name starts incrementing. That would really help us observe the behavior in real time and better understand what's triggering it.

 

Looking forward to your update!

Abhishek

john-9874Author
Participant
July 18, 2025

I made a screen recording. My OS is OSX Sequoia 15.5 (Apple M2 Max)。 But this bug(?) can be reproduced on other versions of OSX as well.

My steps:
1. Quit InDesign 2020
2. Open a.indd and b.indd files (even if you only open a.indd first, and then open b.indd after color retrieval and replacement, you will encounter the same problem)
3. Find and replace on a.indd: 1. keyword :test; 2. font color: red; 3.scope: document (not all documents).. Execute the replacement. 
4,Close a.indd. (If you quit the indesign app, you won't have the problem I mentioned)
5,Repeat 3-4 on b.indd.

I initially found this problem in my code, which is as follows (probably the code is easier to understand than what I'm saying). 

var files = [
    "a.indd",
    "b.indd",
];

var curPath = new File($.fileName).path;
var len = files.length;
for (var i = 0; i < len; i++) {
    var doc = app.open(new File(curPath + "/" + files[i]));
    var redColor = doc.swatches.itemByName("red");
    var tf = doc.textFrames.itemByName("*****");//target textFrame: **edit this
    changeKeywordColor(tf, "test", redColor);
    doc.close(SaveOptions.YES);//close document
}

function changeKeywordColor(textFrameObj, keyWord, colorObj) {
    app.findTextPreferences = NothingEnum.nothing;
    app.changeTextPreferences = NothingEnum.nothing;

    app.changeTextPreferences.fillColor = NothingEnum.nothing;
    app.changeTextPreferences.fillColor = colorObj;//red color

    app.findTextPreferences.findWhat = keyWord;
    textFrameObj.changeText();// Search scope: only the target textFrame
}
Community Expert
July 17, 2025

You'd have to supply the files. 

 

But can you try exporting the files as IDML - then open these in indesign and save as a new file name. 

See if the issue persists. 

 

If it does, you can attach the IDML documents here for testing.

john-9874Author
Participant
July 17, 2025

Thanks.

I've tested both the IDML file and the InDesign file converted from idml, and they both have the same issue. These files were created in InDesign 2020, but based on my testing, this problem exists in all versions from 2020 to 2025.