I didn't want to use the CropMarks.JSX script because it would require me to create a rectangle each time I work on a document. I am also trying to build a script that can be applied to all my art files on a regular basis and shared with my team internally. This would allow consistency across all of the artwork, from the crop mark length, offset amount, and stroke weight. I also want the crop marks to be based on page height and width.
I have been able to develop the crop marks using the below script.
myDocument = app.activeDocument;
//Change Unit of Meausre to Points
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
var myCropMarkLength = 15.12;
var myCropMarkOffset = 20.88;
var myCropMarkWidth = .25;
var myPH = myDocument.documentPreferences.pageHeight;
var myPW = myDocument.documentPreferences.pageWidth;
//Upper Left Crop Mark Pair
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH - myPH, (myPW - myPW) - myCropMarkOffset, myPH - myPH, (myPW - myPW) - (myCropMarkOffset + myCropMarkLength) ];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [(myPH - myPH) - myCropMarkOffset, myPW - myPW, (myPH - myPH) - (myCropMarkOffset + myCropMarkLength), myPW - myPW];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
//Lower Left Crop Mark Pair
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH, (myPW - myPW) - myCropMarkOffset, myPH, (myPW - myPW) - (myCropMarkOffset + myCropMarkLength) ];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH + myCropMarkOffset, myPW - myPW, myPH + (myCropMarkOffset + myCropMarkLength), myPW - myPW];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
//Upper Right Crop Mark Pair
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH - myPH, myPW + myCropMarkOffset, myPH - myPH, myPW + (myCropMarkOffset + myCropMarkLength) ];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [(myPH - myPH ) - myCropMarkOffset, myPW, (myPH - myPH) - (myCropMarkOffset + myCropMarkLength), myPW];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
//Lower Right Crop Mark Pair
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH, myPW + myCropMarkOffset, myPH, myPW + (myCropMarkOffset + myCropMarkLength) ];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
myOutsideGuide_Left = app.activeDocument.pages[0].graphicLines.add ();
myOutsideGuide_Left.geometricBounds = [myPH + myCropMarkOffset, myPW, myPH + (myCropMarkOffset + myCropMarkLength), myPW];
myOutsideGuide_Left.strokeWeight = myCropMarkWidth;
//Change Unit of Measure Back to Inches
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.inches;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.inches;
One of my largest issues when creating this script was determine that the bounds are [Y1,X1,Y2,X2] This was backwards from what I thought they would have been.
Hope that this code helps others in creating crop marks based on page size, but cannot use the InDesign Crop Mark method based on workflows being used.