• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Paste without duplicate color swatches transferring over to InDesign (2)

Explorer ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

Hi,

 

At the company I work at, we use templates for proposals but recently changed the value of two of our brand color swatches and frequently we copy/paste from old documents and the old color (with the same name but different values) come in as separate swatches. See attached file. Is there any way to bring color swatches in (that have the same name) and have them automatically default to the colors in the main file without adding all of the separate swatches? I'm on a PC by the way. Thanks in advance for any help!

 

47B2048A-5F77-4185-BA27-9CF9FB66C707.jpeg

TOPICS
How to , Scripting

Views

329

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

Hi @crystelleb88524938 

It's not built into InDesign, although possibly someone will say it can be done with a script. I've edited your post to tag it for scripting.

 

If you drag a swatch to the trash, InDesign will ask you want you want to replace it with and you can choose the correct color. Or you can alias one swatch to another in the Ink Manager.

 

~ Jane

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

Capture.PNG

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 05, 2021 Feb 05, 2021

Copy link to clipboard

Copied

For process colors the script below will paste, and if there are color definition conflicts, the destination definition will be used.

 

Copy from the source document, make the destination document active and run the script. If it is a constant problem you can assign the script the Paste key command.

 

 

var doc = app.documents.item(0);
//a list of document swatches
var cc = doc.swatches.everyItem().name
app.paste();
//a new list of document colors after the paste
var nc = doc.swatches.everyItem().name
//check the new list against the old list, if a color is not in the old list merge
for (var i = 0; i < nc.length; i++){
    if (!checkItem(cc, nc[i])) {
        var mergename = nc[i].substr(0, nc[i].length-2)
        try {
            doc.swatches.itemByName(mergename).merge(nc[i])
        }catch(e) {}  
    }   
};   



/**
* Checks if an item is in an array
*  the array to check 
*  the item to look for 
*  true if the item is in the array 
* 
*/
function checkItem(a, obj) {
    for (var i = 0; i < a.length; i++) {
        if (a[i] === obj) {
            return true;
        }
    }
    return false;
}

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

Thank you. Yes these are process colors so it sounds like I will need to create a script? I'm not sure how to do this. Do I paste the info that you listed above into the script window somehow? Is this easy to do?

 

This issues happens constantly to our team so can we just have a script in the destination file that the production artist can run to get rid of the unwanted color swatches? Thanks again for your help...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

Here is a compiled copy of the script I posted:

 

https://shared-assets.adobe.com/link/b4c61117-500b-47d4-7e82-110f2f8d76d4

 

Move it into your InDesign Application Folder’s Scripts folder and it will show in your Scripts panel:

 

Applications⁩ ▸ ⁨Adobe InDesign 20XX⁩ ▸ ⁨Scripts⁩ ▸ ⁨Scripts Panel⁩

 

This script will not cleanup existing duplicate problems, but will prevent the problem when you paste. To use it copy, bring the destination document to the front, then run the script from the Scripts panel. Scripts can be assigned key commands, so you can assign it Control-V and conflicting swatches will always use the destination document’s values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

Great, that worked!! Thanks so much! Another question... is there a way to run the script whenever something is pasted? Or will it always be a separarate function.... copy > run script > paste?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

I assign merge color script the Command-V (Control-V windows) key command:

 

Screen Shot 14.png

 

Sorry, I gave the script I posted the confusing name PasteUsesSourceColor.jsx. The merged color is from the destination document you paste into. In my key command example my script is named PasteDocColors.jsx—you can rename the script to whatever you want.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 08, 2021 Feb 08, 2021

Copy link to clipboard

Copied

LATEST

This fixed everything and now the script pastes perfectly. Thanks again!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines