Copy link to clipboard
Copied
Hello Everyone, I am having trouble figuring out how to manipulate the dot shape through script when printing separations.
docRef = app.activeDocument;
sepOpts = new PrintColorSeparationOptions();
jobOpts = new PrintJobOptions();
opts = new PrintOptions();
opts.colorSeparationOptions = sepOpts;
opts.jobOptions = jobOpts;
sepOpts.inkList = docRef.inkList;
sepOpts.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
alert(docRef.inkList[3].inkInfo.dotShape); //blank
sepOpts.inkList[3].inkInfo.dotShape = '[Ellipse]'; //blank
sepOpts.inkList[3].inkInfo.angle = 30;
sepOpts.inkList[3].inkInfo.frequency = 42;
app.activeDocument.print( opts );
I can see by going to the print dialog box, and the output tab after running this, that I am changing both the frequency and the angle. The dotShape however, is blank, so I am not doing it right. I could not find any examples so I am here now haha. I have tried lower case, with and without the brackets. If anyone knows how to do this, please let me know. Thanks Everyone!!
If I run your script it seems to work.
Ignoring what illustrator says, if you look at the ps file as text you will find the setting has worked.
I don't know if this is correct, as I don't really understand what effect this has, but the value does end up in the ps file.
if I manually set the plate to ellipse then look at the ps file created I get a strange string in the same place
so I created it as an array and joined it and the file comes out identical to the one produced manually (note: I used a d
...Copy link to clipboard
Copied
your not doing anything wrong as such.
its the printer you are using.
needs to be a postscript printer.
if you set your default printer to AdobePDF or Acrobat Distiller than your script should work.
Copy link to clipboard
Copied
Thanks for your help,
I did not realize before but for the script to work I needed to be using print preset options as well, so my bad if someone used the script and got an error. I notice when I make new print options through script it over rides part of the print preset options , hence why I added the hostbasedseperation part, so maybe that is the problem. So incase the ppd name and the printer name were being changed, I added those.
docRef = app.activeDocument;
sepOpts = new PrintColorSeparationOptions();
jobOpts = new PrintJobOptions();
opts = new PrintOptions();
opts.colorSeparationOptions = sepOpts;
opts.jobOptions = jobOpts;
opts.printPreset = 'Print Preset 1';
opts.PPDName = 'AdobePdf';
opts.printerName= 'Adobe PostScript File';
sepOpts.inkList = docRef.inkList;
sepOpts.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
// alert(docRef.inkList[4].inkInfo.dotShape)
sepOpts.inkList[4].inkInfo.dotShape = 'ellipse'; // tried 'Ellipse' 'ELLIPSE' 'ellipse' '[Ellipse]' '[ELLIPSE]' '[ellipse]'
sepOpts.inkList[4].inkInfo.angle = 30;
sepOpts.inkList[4].inkInfo.frequency = 42;
app.activeDocument.print( opts );
Here is what it looks like afterwords. You can see the Frequency and Angle are being edited for the orange, so at least I am doing something right, but the dot shape shows up blank like that no matter what I do.
Thanks again for taking a look at this. It sucks when one minor detail like this turns into a pain haha
Copy link to clipboard
Copied
Since I able to edit the frequency and angle, I think that would mean my printer and all the other options are correct. Since the dot shape is blank, at least I know I am able to access it, just not correctly. All that I can find out is that it is a string, I cannot find any examples of it being used anywhere online. ugh lol.
Copy link to clipboard
Copied
I find in my quick test that setting the dot shape, angle, or frequency and saving/loading a preset through UI does not actually populate those fields. Maybe it's because I used the Adobe PDF printer in this preset?
Copy link to clipboard
Copied
I haven't tested the adobe pdf printer through the script but just doing it manually it allows changes to those areas as long as the output mode is separations host base so idk why it wouldn't be changing that's weird. I did a test tho with my postscript files manually using halftones and converted them to tifs, one with ellipse, and one with dot, and they looked identical to me. So maybe the way I am outputting, it does not make a difference, which is weird because like I showed in the dialog box, it seems as tho I would be allowed to change it which made me paranoid I was just writing the string wrong. Thanks to both of you for looking at this, I think for now I will just not mess with the dot shape unless someone notices a difference.
Copy link to clipboard
Copied
If I run your script it seems to work.
Ignoring what illustrator says, if you look at the ps file as text you will find the setting has worked.
I don't know if this is correct, as I don't really understand what effect this has, but the value does end up in the ps file.
if I manually set the plate to ellipse then look at the ps file created I get a strange string in the same place
so I created it as an array and joined it and the file comes out identical to the one produced manually (note: I used a diff preset number...)
docRef = app.activeDocument;
sepOpts = new PrintColorSeparationOptions();
jobOpts = new PrintJobOptions();
opts = new PrintOptions();
opts.colorSeparationOptions = sepOpts;
opts.jobOptions = jobOpts;
opts.printPreset = 'Print Preset 2';
opts.PPDName = 'AdobePDF';
opts.printerName= 'Adobe PostScript File';
sepOpts.inkList = docRef.inkList;
sepOpts.colorSeparationMode = PrintColorSeparationMode.HOSTBASEDSEPARATION;
// alert(docRef.inkList[4].inkInfo.dotShape)
sepOpts.inkList[4].inkInfo.dotShape = ['{abs exch abs 2 copy 3 mul exch 4 mul add 3 sub dup 0',
'lt { pop dup mul exch .75 div dup mul add 4 div 1 exch sub } { dup 1 gt{',
'pop 1 exch sub dup mul exch 1 exch sub .75 div dup mul add 4 div 1 sub }',
'{ .5 exch sub exch pop exch pop } ifelse } ifelse } bind'].join('\n');
sepOpts.inkList[4].inkInfo.angle = 30;
sepOpts.inkList[4].inkInfo.frequency = 42;
app.activeDocument.print( opts );
hope this helps
Copy link to clipboard
Copied
This works, thanks so much for taking the time to figure it out. It marks ellipse down in Illustrator after I print, and my Rip can also read the postscript file so that was exactly the string it was looking for, I would have never guessed that in a million years ha. Thanks for explaining how you figured it out as well, what program do you use to look at the post script file as text?
Copy link to clipboard
Copied
I use Notepad++ a lot for editing/viewing all sorts of files.
it has many syntax highlighters and plugins for comparing documents.
all I did was set the ellipse manually and then compared that file to one that had "Ellipse" added by the script.
this showed me the lines that were not the same.
looking at Files as text can be a great way to find out what is going on.
You would be surprised how many file formats are kinda readable...
ie. finding the author of a pdf saved from illustrator is just a matter of opening in a simple text editor and doing a search for "For:"
this can be easily scripted with most languages. finding the author, Creation Date, Illustrator version, etc.. is just as simple and can be done with Regex very easily.
SVG is a good one, its all XML and does not have coded file length tags.
this means you can edit it in a text editor and it will still open fine.
you can embed an SVG file in HTML and animate,change colors, modify any point in it all via Javascript.
but I am just babbling now, glad I could help on this one...
Copy link to clipboard
Copied
Cool thanks for all of the information, I really appreciate all of the help.
Copy link to clipboard
Copied
I hope to never have this issue to figure out, but if I do, I'm very glad you've put the effort to provide us with this answer.