Hi Maple,
I am not sure of the direct way to do this in Javascript. But here is the sample code, that will create, two lines exact at same position, one line will have one solid stroke color and another line will dashed stroked color. And after that both lines are grouped together. Here is the snippet
#target illustrator
function createLine() {
var doc = app.activeDocument;
var line = doc.pathItems.add();
line.stroked = true;
line.width = 4;
line.setEntirePath(Array(Array(100, 100), Array(375, 100)));
return line;
}
function main() {
var firstLine = createLine();
var color = new CMYKColor();
color.cyan = 85;
color.magenta = 10
color.yellow = 100;
color.black = 10;
firstLine.strokeColor = color;
firstLine.strokeDashes = [];
var secondLine = createLine();
var color = new CMYKColor();
color.cyan = 0;
color.magenta = 95;
color.yellow = 20;
color.black = 0;
secondLine.strokeColor = color;
secondLine.strokeDashes = new Array(12, 12);
firstLine.selected = true;
secondLine.selected = true;
app.executeMenuCommand('group');
}
main();
Ofcourse, there is no gap right now in the lines. and the lines will look line as in screenshot.
