Copy link to clipboard
Copied
anyone know of a script that will create interior crops like the attached? I have to create these many times a day manually, and a script would be a huge timesaver!
AI or INDD would work for me
Hi @Kev28410820xkum , try this:
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
app.activeDocument.zeroPoint = [0, 0];
var ll = 12, //line length
lt = 1, //line thickness
p = app.activeWindow.activePage,
pb = p.bounds,
cl = makeLayer(app.activeDocument, "Crop Marks");
cl.move(LocationOptions.AT_BEGINNING);
app.activeDocument.activeLayer = cl;
//horizontal
var myLine = makeLine(p,ll,lt,true)
myLine = makeLine(p,ll,lt,true);
myLine.move([pb[3]-ll,0]);
myLine
...
Copy link to clipboard
Copied
Hi @Kev28410820xkum do you need this in 4 corners the page, is this?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
What kind of projects do you work on? The fact that either ID or AI scripting is convenient for you is the source of my questions. Is it some kind of PDF imposition and marks for some cutter? I am asking because there may be more appropriate solutions for your true needs.
Copy link to clipboard
Copied
manual cutting and adding the crops internally usually means we can get an extra item on the material width.
Copy link to clipboard
Copied
Yes but what about using PDF tools like PitStop to add your marks? An action list can do that in a blink with no code 😉
Copy link to clipboard
Copied
Just draw it on your parent page(s)
Copy link to clipboard
Copied
Hi @Kev28410820xkum , Are the crop marks there as a guide for trimming? If they are, the crops you are showing in the capture would be visible after the page is trimmed—normally they would be offset from the page.
Copy link to clipboard
Copied
Hi @Kev28410820xkum , try this:
app.scriptPreferences.measurementUnit = MeasurementUnits.POINTS;
app.activeDocument.zeroPoint = [0, 0];
var ll = 12, //line length
lt = 1, //line thickness
p = app.activeWindow.activePage,
pb = p.bounds,
cl = makeLayer(app.activeDocument, "Crop Marks");
cl.move(LocationOptions.AT_BEGINNING);
app.activeDocument.activeLayer = cl;
//horizontal
var myLine = makeLine(p,ll,lt,true)
myLine = makeLine(p,ll,lt,true);
myLine.move([pb[3]-ll,0]);
myLine = makeLine(p,ll,lt,true);
myLine.move([0,pb[2]-lt]);
myLine = makeLine(p,ll,lt,true);
myLine.move([pb[3]-ll,pb[2]-lt])
//vertical
myLine = makeLine(p,ll,lt,false)
myLine = makeLine(p,ll,lt,false)
myLine.move([pb[3]-lt,0]);
myLine = makeLine(p,ll,lt,false);
myLine.move([0,pb[2]-ll]);
myLine = makeLine(p,ll,lt,false);
myLine.move([pb[3]-lt,pb[2]-ll])
app.scriptPreferences.measurementUnit = AutoEnum.AUTO_VALUE;
/**
* Make a graphic line
* @ param page destination
* @ param line length
* @ param line thickness
* @ param true horizontal or false vertical
* @ return the line
*
*/
function makeLine(p,l,t,h){
var ln = p.graphicLines.add({strokeColor:"Black", strokeWeight:t});
if (h) {
ln.geometricBounds = [0,0,0,l];
ln.strokeAlignment=StrokeAlignment.INSIDE_ALIGNMENT;
} else {
ln.geometricBounds = [0,0,l,0]
ln.strokeAlignment=StrokeAlignment.OUTSIDE_ALIGNMENT;
}
return ln
}
/**
* Makes a new named Layer
* @ param the document to add the layer
* @ param layer name
* @ return the new layer
*/
function makeLayer(d, n){
if (d.layers.itemByName(n).isValid) {
return d.layers.itemByName(n);
} else {
return d.layers.add({name:n});
}
}