Copy link to clipboard
Copied
Hii!!
i'm trying to make a script for a batch process.
If a file is in RGB mode then it has a set of sequence to run on.
If its a CMYK mode file then it should execute another set of sequence.
But i cant filter the file mode..
anyone pls help me on this..
Copy link to clipboard
Copied
DocumentColorSpace tells you the color mode.
Copy link to clipboard
Copied
Hi Jong,
i tried this but it returns "undefined".
var newcolor = activeDocument.DocumentColorSpace
alert (newcolor)
i think i made mistake on this
pls check and rectify my error
Copy link to clipboard
Copied
DocumentColorSpace is the name of the enumeration. The Document property is called "documentColorSpace"; for a DocumentPreset, it's called "colorMode" (see a system here?).
Of course, the documentation should have told you that -- in the CS4 guide, it's from p. 36 onwards.
var newcolor = activeDocument.documentColorSpace;
alert (newcolor);
Copy link to clipboard
Copied
Sorry what I posted is ONLY meant to be used with native Illustrator files '.ai' else it will loop endlessly… It just reads a File comment string… EPS are old, fat and overly complex for me to bother with… almost any app can create them and they can contain the kind of data I could never sift thru… if I had years to try… I would do as Jong has suggested and open the file to see the mode… However an RGB eps can contain CMYK postscript data and thats where it all starts to become a bit fuzzy…
Copy link to clipboard
Copied
Hello Mark,
"%%DocumentProcessColors: Black"
-----This is the comment if the file documents is in black and white
"%%DocumentProcessColors: Cyan Magenta Yellow Black"
-----This is the comment if the file documents is in CMYK
And for RGB this comment is missing.
How can i make your script to check these conditions?
help me on this pls.
Thanks in advance.
Praveen
Copy link to clipboard
Copied
The comment could be… Any combination of the 4 process colours used or none if its empty or white. The colour mode is in a similar comment with a 1 or 0 to indicate CMYK or RGB.
Copy link to clipboard
Copied
Ya, u are right... but eps files dont have "colour mode" its only for ai files.
Can we utilize "%%DocumentProcessColors:" comment for eps files..??
if file.readin() = "%%DocumentProcessColors: Black" is true then it should return black
if file.readin() = "%%DocumentProcessColors: Cyan Magenta Yellow Black" is true then it should return CMYK
if file.readin() = "%%DocumentProcessColors:" is null then it should return RGB
is it possible?
Copy link to clipboard
Copied
With Illustrator EPS the files can be RGB or CMYK… Only files pre version 9 can contain both and if you open these you will be prompted to force to one or the other color modes. That said with RGB files there is a save option to include CMYK postscript if this is true then the line %%DocumentProcessColors: will exist in the comments if false it will not and the posted function should return null… Remember this list is the process separations and only the ones that are used…
Copy link to clipboard
Copied
Thanks Mark,
I have my eps file created with Illustrator CS2 and those not included with CMYK postscript. So the eps files of CMYK mode have %%DocumentProcessColors: and the RGB moded files dont have this comment.
Copy link to clipboard
Copied
If it is Illustrator .ai files that you are dealing with then this may help…
var f = new File('~/Desktop/SomeFile.ai'); alert(aiMode(f)); function aiMode(f) { var mode = null; f.open('r'); do { var line = f.readln(); } while (!/^%AI\d_ColorModel: [1-2]/.test(line)); var m = line.match(/\d$/g); m == 1 ? mode = 'RGB' : mode = 'CMYK'; f.close(); return mode; }
Copy link to clipboard
Copied
Thanks lot Mark.. its works the best with "*.ai" files.
but i'm on "*.eps" files. it cant read its data.
could u pls help me..
Manythanks in advance..
Find more inspiration, events, and resources on the new Adobe Community
Explore Now