Copy link to clipboard
Copied
Hi,
I need to create rectangular frame with 0.5 pt stroke with CMYK value of 0, 0, 0 , 100 and with overprint on specific layer.
Here what I have figured out so far, maybe:
var myDoc = app.activeDocument;
var myLayer = myDoc.layers.add();
myLayer.name = "GUIDES";
myCardWidth = myDoc.width;
myCardHeight = myDoc.height;
myTrimLine = myLayer.pathItems.rectangle.add();
myTrimLine.geometricBounds = (0, 0, myCardWidth, myCardHeight);
myTrimLine.filled = false;
myTrimLine.stroked = true;
myDoc.strokeWidth = 0.5 pt;
myDoc.documentColorSpace.CMYK
var newCMYKColor = new cmykColor();
newCMYKColor.black = 100;
newCMYKColor.cyan = 0;
newCMYKColor.magenta = 0;
newCMYKColor.yellow = 0;
Thank you for your help.
Yulia
Hi @Yuliascript, you are on the right track! Here's a version that does each of things you want. Please look through each part and compare to your script and see what I've done differently.
- Mark
/**
* @author m1b
* @discussion https://community.adobe.com/t5/illustrator-discussions/create-frame-in-illustrator-with-js/m-p/14441605
*/
(function () {
var myDoc = app.activeDocument;
// get (or make) the layer
var myLayer,
layerName = "GUIDES";
try {
myLayer = ...
Copy link to clipboard
Copied
Hi @Yuliascript, you are on the right track! Here's a version that does each of things you want. Please look through each part and compare to your script and see what I've done differently.
- Mark
/**
* @author m1b
* @discussion https://community.adobe.com/t5/illustrator-discussions/create-frame-in-illustrator-with-js/m-p/14441605
*/
(function () {
var myDoc = app.activeDocument;
// get (or make) the layer
var myLayer,
layerName = "GUIDES";
try {
myLayer = myDoc.layers.getByName(layerName);
} catch (error) {
myLayer = myDoc.layers.add();
myLayer.name = layerName;
}
// make the black color
var myBlack = new CMYKColor();
myBlack.black = 100;
myBlack.cyan = 0;
myBlack.magenta = 0;
myBlack.yellow = 0;
// make a rectangle the size of the first artboard
var bounds = myDoc.artboards[0].artboardRect;
var myTrimLine = myLayer.pathItems.rectangle(bounds[1], bounds[0], bounds[2] - bounds[0], -(bounds[3] - bounds[1])); // TLWH
// set the rectangle's properties
myTrimLine.filled = false;
myTrimLine.stroked = true;
myTrimLine.strokeWidth = 0.5;
myTrimLine.strokeColor = myBlack;
myTrimLine.strokeOverprint = true;
})();
Copy link to clipboard
Copied
Thank you, Mark. It works perfectly!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more