I keep trying this from different angles but I am clearly not succeeding.
I have thousands of hex codes in a CSV that I inserted as a variable into a text layer into respective tiffs. Ie, CSV says "000000", a text layer now reads "000000" in its own unique tiff.
I am wondering how on earth to copy the text from that layer (hex value), and fill a new layer on top with that colour, then save the file as a jpg. I imagine it's a script that would be added into an action?
I originally started with actions, but found that I couldn't actually get the hex code copied onto the clipboard to work, it just kept using the hex values from my tests (and ended up with about 100 pink squares before I stopped it).
I tried looking into writing my own script, but that didn't work, as I do not have very much JS experience.
I have tried to look into the community boards but they are slight differences that I do not know how to edit to make work for what I need.
I have looked into the VariableImporter.jsx from Vasily Hall, was sure to set up the file with notes in Illustrator, but clearly didn't do it correctly as I wouldn't be writing this, hah.
Looking for tips and assistance,
How many text layers per file? Only one?
Is the source text layer always in a consistent position in the layer stack, i.e. at the top?
Where/what position will the new solid fill layer appear in the layer stack in relation to the source text layer?
Can you show a cropped screenshot of the layers panel from a few different files (with all layer sets fully expanded)?
There is only one text layer per file, and I have placed the text layer in the same spot for every layer.
New solid fill would be a new layer on top (making hex value irrelevant visually).
Please let me know if I can expand more:
-current tiff file with one text layer (pulled using variables following PiXimperfect's tutorial):
- Theorteical end result:
Whoops, .psd files. I doubt that matters though
t=(ad = activeDocument).activeLayer.textItem.contents; (c = new SolidColor).rgb.red = parseInt(t.substr(0,2),16); c.rgb.green = parseInt(t.substr(2,2),16); c.rgb.blue = parseInt(t.substr(-2),16); (ad.artLayers.add()).name ='swatch'; ad.selection.fill(c);
txt = (aD = activeDocument).activeLayer.textItem.contents; (solidcolor = new SolidColor).rgb.hexValue = txt; (aD.artLayers.add()).name = 'swatch' aD.selection.fill(solidcolor)
damn! it was obvious 🙂
I am so happy right now, you have no idea. Thank you!!! I have awarded yours as the correct answer as it was the first one in!
I'm glad you have the answers you need, I thought that the text was coloured with the hex fill colour, so I was looking at geting the colour property from the text object, now that I can see images that would not have worked as I misunderstood your previous posts.
So do you want to automatically create all the files based on the CVS? You could have a base file formatted with the text and a solid color fill layer, then have a script change the text value and the fill color. Or you could just create a new file each time. How is the CVS formatted: all values in a row or a column?
More than one way to skin a cat I guess hah.
The data lives in a google sheet, that I've exported the relevant columns as a CSV to work locally. It does not need to be data that is pulled constantly, just a one time use. It has 2 columns with maybe 2k rows of values?
Using actions and variables, I created all the artwork, named as needed, in the correct size with the hex value in it as I couldn't figure another way without any scripting knowledge. The end result will be a jpg, so there is no need for the text layer in the end, I just didn't know how to pull it.