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});
}
}