Copy link to clipboard
Copied
This script must exist but I'll be damned if I can find it!!!
I work in a large printing company and we get artwork from all over that has dodgy CMYK colours (quick convertions from RGB obviously). We have noticed that these colours don't rip as well as rounded CMYK colours, so we spend a lot of time cleaning them up and rounding them down...
I'd like to be able to just run a script that does this to a whole document, including the colours inside gradients. So if for example the number is .5 or below we round down, or above we round up.
Does this exist, does anyone know?
CHEERS!
S
Copy link to clipboard
Copied
I have made this one, I couldn't find the thread where it was requested...to get some background on it.
see if it does what you need.
var idoc = app.activeDocument;
var sws = idoc.swatches;
for (i = 0; i<sws.length; i++) {
var sw = sws[i];
if (sw.color.typename == "CMYKColor")
roundColorValues (sw.color);
else if (sw.color.typename == "SpotColor") {
//$.writeln(sw.color.spot.getInternalColor());
roundColorValues (sw.color.spot.color);
//$.writeln(sw.color.spot.getInternalColor());
}
}
function roundColorValues(color) {
var col = color;
col.cyan = Math.round(col.cyan);
col.magenta = Math.round(col.magenta);
col.yellow = Math.round(col.yellow);
col.black = Math.round(col.black);
}
Copy link to clipboard
Copied
Scratch the below, this DOES work if I select all my artwork, then go SWATCHES > ADD SELECTED, and then run the script with the artwork still selected...!
Awesome, thanks Carlos...
________________________________
Hey Carlos, thanks for the reply!
That worked partially: if I go through the artwork and pick out all the colours I need to change and add them to my swatch library manually, then when its done its magic I go through and repick them all to the new fixed colours (when you have a document that has 50 or 100 colours you're bound to miss one).
I want to be able to just run it on the active document and let it find every colour and round everyone it finds, so I guess there needs to be a step where it finds the next colour, does your thing, then moves on until its done the whole document.
s
Copy link to clipboard
Copied
you're welcome
Copy link to clipboard
Copied
Thanks Carlos, it is very useful
Copy link to clipboard
Copied
Yes VERY useful. You wouldn't believe how many times we get sent complex logos that have obviously been developed in RGB and then switched over to CMYK. We open them and go "pffff....." and start manually cleaning them up. This script eliminated this mindless task! Thanks again Carlos.
Copy link to clipboard
Copied
This is wonderful and would save me literally hours of time. However, I tried adding it to a new script file and kept getting errors. Any tips for script beginners?
What I did was to open a new apple script file and then copy and paste the info above exactly as typed. I get a message saying: "Syntax Error
A identifier can't go after this identifier"
and "var idoc" is highlighted.
Any help you could offer would be much appreciated.
Copy link to clipboard
Copied
Yes its brilliant I use it daily - you have to use it correctly though. Firstly select all the artwork that you want to round, and in your swatches tab go "Add Selected Colours" - then (with the artwork still selected) run the script and it will round them all.
Copy link to clipboard
Copied
Thank you, but the problem is that I'm having trouble creating the script. Do you have any tips on how to do that? See my notes above. Thanks!
Copy link to clipboard
Copied
Hmmm I'm using it exactly as it was written above. Just copy and paste it into ExtendScript Toolkit and save it as a .jsx in your Illustrator/Presets/en_GB/Scripts folder and restart illustrator.
Copy link to clipboard
Copied
It worked! Thank you so much, this is a lifesaver. Well, a huge timesaver.
Copy link to clipboard
Copied
how would you set the threshold? for example if the colour is orange so the CMYK values are
C = 0%
M = 45%
Y = 100%
K = 0%
whats stopping this script from rounding the colour to 50% magenta or 40% magenta? wheres the threshold?
hold would you have more control?
Copy link to clipboard
Copied
the script rounds the decimal places only, say
M = 45.333% to M = 45%
Copy link to clipboard
Copied
I know i have problems with yellow when i convert from RGB it always have about 6% cyan in, to convert to CMYK i change the colour document mode and then i have to change the colour to remove the small 6% is there no script out there that i can say:
if colour = c = 6% m= 0% y=100% k=0%
the change to c= 0% m=0% y=100% k=0%
as rounding it up and down just by decimal places is not good enough i need to change the colours, i don't mind defining which ones need changing and what to as the colours never change but having to do this every day is very frustrating
Copy link to clipboard
Copied
Nothing you can do about that - no script would be intelligent enough to know how to interpret what colours you REALLY want. Try converting your blacks from RGB - they are no where near where I usually want them - usually:
C75, M68, Y67, K90...
Print that and I get GREY. I have to manually set them to 40,30,20,100
If you are doing this constantly with one colour, make yourself a little swatch library and then use replace colour.
s
Copy link to clipboard
Copied
I also do this with black and once in CMKY change it to C=0 M=0 Y=0 K=100 but i can't believe there is not script that i can create to maunally add each colour to inteligently replace the colours automatically. From one to another?
do you mean go to edit > edit colours > recolour with preset?
this is not really a solution at all.
I need a script which i can add the colour and what to replace it with and just run the script everytime i need to convert the colours
Copy link to clipboard
Copied
the way you describe it seems possible to script...check the other thread to see if that helps your workflow
Copy link to clipboard
Copied
i've replied to you on the other thread
Copy link to clipboard
Copied
Thank you so very much CarlosCanto, your script was just what I was looking for.
Copy link to clipboard
Copied
Hi
I'm resurrecting this old thread, as this Script to round fractional CMYK will be a bit of a timesaver if with help I can get it working.
I hope someone can help out here.
Unfortunately this seems not to work in Illustrator 2021 and i'm no programmer, and have no clue how to fix it.
The error I am getting is
Error 1302: No such element
Line: 9
-> if (sw.color.typename == "CMYKColor")
Can anyone point me in the right direction to get this working please?
Copy link to clipboard
Copied
Hi Bill, old scripts got messed up with the recent forum update, try copying it again, I just fixed it.
Copy link to clipboard
Copied
Carlos, thank you. That has really saved me doing some real fiddly figure work. I really appreciate you fixing this
Thank you adain
Copy link to clipboard
Copied
I am having an issue when using this script as when my colour are 100 in CMYK (not sure the K), when adding it into swatches, it will turn into registration colour,which doesnt print out at all. Can anyone advice?