Captions or scripts to label color swatch in document

Community Beginner ,
Dec 20, 2021 Dec 20, 2021

Copy link to clipboard

Copied

I'm working on a document with lots of squares showing color swatches. The layout is already set and varies by page. I'm looking for a script to work similar to how live captions work for images. If possible, I would like it to be dynamic so if I change the color in the square the name under it changes to the new color swatch name. Is there a script to to add color names under preset color swatches on a page? Or is there a way to do this with live captions?

 

I was given a script that can make squares with the swatches name in a grid pattern, but my format isn't just a consistent grid and I want the colors in a certain order. I'm looking for something that works more closely like a caption for images. When the image changes the caption under changes. So when the color swatch used changes the color name listed below would also change.

 

I haven't been able to find this so far so also is there anyone out there who can make this kind of script? 

 

Any guidance on who to contact to make custom scripts would be useful!

 

Thank you!

TOPICS
Scripting

Views

219

Likes

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

correct answers 1 Correct answer

Engaged , Jan 03, 2022 Jan 03, 2022
I also made a video tutorial for the script: https://youtu.be/BPItfdZJtsc

Likes

Translate

Translate
Engaged ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

The dynamic aspect won't be posssible with a script (at least, easily). Scripts run when you ask them to, then are done. It's not usual for a script to continuously poll the document for changes, then act. Are the color labels the swatch names? If so, it wouldn't be difficult to make a script to run each time you update the color patches, and the script either generates the labels from the swatch names (if they don't exist) or if they do exist, replaces them with the current swatch names assigned to each color patch.

 

Script writing is what I do, free ones, and for-hire custom solutions. Your need sounds like a good idea for a new script, which I'm always on the watch for. I may try some ideas but still curious if the swatch name is what you're after. That shouldn't be too diffcult.

 

See my scripts here (most are free download): https://www.marspremedia.com/software/

Custom stuff the fee varies of course depending on complexity.

 

William Campbell

Likes

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 Beginner ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Hi William,

I wasn't sure if a script could work like a dynamic live caption on an image, but it makes sense that it wouldn't. It would work for me though if I colored the boxes and then just ran the switch everytime I made adjustments. Below is an example of what it would be like. (For those boxes that are colored, the name of the color swatch appears below the color box. 

 

I have many rows and columns of boxes, but not all rows consistent with the same number of boxes. The box size and font would all be consistent though. There are thousands of boxes and typing the color swatch name each time is time consuming and could have typos. 

 

If you could make a script to help make this work, that would be amazing! If it is something that would require custom development, please let me know and we can discuss.

 

Thank you!

color swatch example.JPG

Likes

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
Engaged ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Great illustration. That really helps visualize the goal. Yes, this kind of thing is quite possible. I assume the document structure is already done, so the script doesn't have to make the rectangles and text frames, only update the text from the swatch names. In that case, it's not too difficult. I have another script "Headshot Layout" that works similar, and I can pull parts from. That script place images and matches text to each, much like your example, each a rectangle with text frame below it. Give me a day or two to play with the idea, and I'll post back here when I have something to try.

 

William Campbell

Likes

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 Beginner ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Perfect! Yes the squares and text frames are already created in a document. As I color the squares I was just updating the text manually. The format of each page might be different with a different number of squares in row so I'm not sure if that will be an issue. 

 

I really really appreciate this and please let me know if you have any questions as you are working on it!

Likes

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
Engaged ,
Dec 21, 2021 Dec 21, 2021

Copy link to clipboard

Copied

Turned out not difficult at all. Lots of my scripts are like Lego pieces. Just plug together different blocks of code to get something new. Got it done already. First draft so maybe a glitch will show up. If so just let me know. Download at the link below.

 

https://www.marspremedia.com/download?asset=swatch-names.zip

 

William Campbell

Likes

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 Beginner ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

Hi William,

Thank you so much for this. First please forgive me as I'm not the most skilled at InDesign so I might have set this up wrong or there might be a better way to set up my document to make this work.

 

There are other text boxes on the document that got filled out. It did seem to fill them out in the order of the color boxes, but in the wrong spot. I'm sorry I forgot to mention there were other text boxes in the document so I'm sure this is messing up the script.

 

Where it says Jolly Green (the color of the first square), it orginally said 2021 Holiday. Then the top row and left side row were just numbers. I'm assuming having these extra text boxes is messing up the script. See below for screen shots. 

 

Not sure if it is possible for a script to ignore certain text boxes. Is there a better way for me to set up this document?

 

I also attached this test document if it is an easier reference for you. 

 

ORIGINAL:

KMColor_2-1640199084008.png

 

AFTER SCRIPT:

 

KMColor_4-1640199230682.png

 

 

Likes

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
Engaged ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

Yes the script expects a simple document. However, I can use the same code from the other script which is the images (in this case, colored rectangles) are on one layer, and the text boxes that refer to them are on another layer. That works in all cases, even if other elements on each page, just so long as not on either the rectangles or text layers. Is it too much work to set up the document that way? With separate layers for the swatch rectangles, and another layer for their text labels? If so, it won't be difficult to modify for that. Let me know. Thanks.

 

William Campbell

Likes

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 Beginner ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

Hi William,

So I would have one layer with the colored squares, one layer with their text labels and then if I had any extra elements and more text, those would be on another layer? 

 

I could do that as this is just a draft I was making to see what's possible to automate before I set up the actual document. It should be easy enough to just make layers.

 

Thanks!

Likes

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
Engaged ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

Actually, the color squares (rectangles) and text frames could be on one layer. Just so that is all there is. Keep all the other stuff on other layers. Or the rectangles and text frames can each be on their own unique layers. Either way works. But if on one layer, the text frames must be text frames, otherwise the script will see all as rectangles.

 

Layers is the best way to identify the elements to work with. Only other way is with object styles but it just gets more complicated.

 

Anyway, this script has morphed into another, because I realized this is pretty useful for another purpose too -- label placed images with their file names. I've renamed the script "Rectangle Labels" and now it has an interface. First choice is the "source" of the labels, swatch or image name, then choose the layer for the rectangles, and for the text. I'll make a web page with instructions once all is settled, but for now you can download, and it should do exactly what you need. Let me know any problems. I'll get right on it.

 

EDIT: I re-thought this and decided to keep the two tasks as separate scripts. So it's back to "Swatch Names" like it was to start. And instead of combining them together, I also made another script "Image Names". Keep each specific that way.

 

EDIT #2: I got the web page for each done this morning. The links below now go there, where there are download buttons to get the scripts. Enjoy. Let me know any problems. I'll get on it quick.

 

https://www.marspremedia.com/software/indesign/swatch-names

 

https://www.marspremedia.com/software/indesign/image-names

 

William Campbell

Likes

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 Beginner ,
Dec 22, 2021 Dec 22, 2021

Copy link to clipboard

Copied

Thank you! I will be testing this soon and let you know. You are a life saver!

Likes

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
Engaged ,
Dec 26, 2021 Dec 26, 2021

Copy link to clipboard

Copied

In case you missed the edit to my earlier reply, here is the latest link to get the swatches script, and another separate script for labeling images with their file name.

 

https://www.marspremedia.com/software/indesign/swatch-names

 

https://www.marspremedia.com/software/indesign/image-names

 

William Campbell

Likes

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
Engaged ,
Jan 03, 2022 Jan 03, 2022

Copy link to clipboard

Copied

I also made a video tutorial for the script:

 

https://youtu.be/BPItfdZJtsc

 

William Campbell

Likes

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 Beginner ,
Jan 04, 2022 Jan 04, 2022

Copy link to clipboard

Copied

William....you are AMAZING!!!!

 

Thank you so much! This works perfectly and I'm so excited for this. You just saved me weeks of work!

Likes

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
Engaged ,
Jan 04, 2022 Jan 04, 2022

Copy link to clipboard

Copied

Awesome! Glad I could help.

 

William Campbell

Likes

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
Engaged ,
Jan 31, 2022 Jan 31, 2022

Copy link to clipboard

Copied

LATEST

Today I've posted a video for the "Image Names" version of the script. It's nearly the same script, but instead of swatches, it grabs the file name of placed graphics and updates the nearby text frame.
https://youtu.be/dO3Tn7VaT5M

 

William Campbell

Likes

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