Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

anyone know of a script that will create interior crops?

Explorer ,
Feb 14, 2023 Feb 14, 2023

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

Screenshot 2023-02-14 at 2.55.16 PM.png

TOPICS
Scripting
1.3K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Feb 16, 2023 Feb 16, 2023

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
...
Translate
Participant ,
Feb 14, 2023 Feb 14, 2023

Hi @Kev28410820xkum do you need this in 4 corners the page, is this?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 14, 2023 Feb 14, 2023
Yep in all four corners
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 14, 2023 Feb 14, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Feb 15, 2023 Feb 15, 2023

manual cutting and adding the crops internally usually means we can get an extra item on the material width.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 15, 2023 Feb 15, 2023

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 😉

LoicAigon_0-1676469957162.png

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2023 Feb 14, 2023

Just draw it on your parent page(s)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 15, 2023 Feb 15, 2023

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 16, 2023 Feb 16, 2023

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

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 26, 2023 Jul 26, 2023

that was SO helpful! Thanks - unfortunately, none of my custom script seem to work now - I've no idea what happened. I'm using INDD 18.4 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 26, 2023 Jul 26, 2023

Hi @Kev28410820xkum , Do you mean when you run the script from the scripts panel you get an error, or nothing happens? If it’s an error can you show the error alert?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 27, 2023 Jul 27, 2023

I did some research last night - it's odd, but if I move my custom scripts out of the user script folder and into this folder:

applications/adobe indesign 2023/scripts/community/scripts panel/

they all work!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 27, 2023 Jul 27, 2023
LATEST

In the Scripts panel you can right-click one of the root folders (Application, Community, and User) and get Reveal in Finder—you might do that to confirm you have the correct folder.

 

Screen Shot 36.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines