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

Add bleed input to a slug

Explorer ,
Aug 19, 2021 Aug 19, 2021

Copy link to clipboard

Copied

Hi all you big brains.

I know nothing about scripting but I've managed to amend a script an old work collegue did for me many moons ago. I need to be able to add the bleed amounts to the relevant parts of a slug made from a table:

Screenshot 2021-08-19 at 16.32.51.png

I have text variables for the Ref (file name), Mod dates, Mod by and have a script for the width and height inputs:

 

// WORKING ON CURRENT DOCUMENT
var myDocument = app.activeDocument;

// INITIAL SETTINGS
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
myDocument.zeroPoint=[0,0];
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

// WORKING WITH ACTIVE PAGE
var currentPage = myDocument.layoutWindows[0].activePage;
var width, height; // SOME VARIABLES

// GETTING THE PAGE SIZES
width = currentPage.bounds[3] - currentPage.bounds[1];
height = currentPage.bounds[2] - currentPage.bounds[0];

// ROUND THE NUMBERS
var widthRounded = width.toFixed(2);
var heightRounded = height.toFixed(2);

var realHeight = heightRounded*10;
var realWidth = widthRounded*10;

var ShowType;

// WORKING WITH TABLES ON THE ACTIVE PAGE
var myTables = app.layoutWindows[0].activePage.textFrames.everyItem().tables;

// show row and column of selected cell
//alert(app.selection[0].parentRow.index+"\n"+app.selection[0].parentColumn.index);

// CHECK IF THERE IS THE SLUG IN THE DOCUMENT
if(myTables.length>0)
{
ShowType = "ORG-GARTNER";
// PLACE THE SIZES IN THE SLUG
myTables[0].cells[12].contents = (""+realWidth);
myTables[0].cells[13].contents = (""+realHeight);
}

 

 

If anyone could tell me what to add and where, I would be extremely grateful and send you a virtual donut.

TOPICS
Scripting

Views

456

Translate

Translate

Report

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

Advisor , Aug 20, 2021 Aug 20, 2021

Hi @Mayberry_Maybz,

 

Give this a try....

// WORKING ON CURRENT DOCUMENT
var myDocument = app.activeDocument;

// INITIAL SETTINGS
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
myDocument.zeroPoint=[0,0];
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

// WORKING WITH ACTIVE PAGE
var currentPage = myDocument.layoutWindows[0].activePage;
var width, height; //
...

Votes

Translate

Translate
Advisor ,
Aug 19, 2021 Aug 19, 2021

Copy link to clipboard

Copied

Hello @Mayberry_Maybz

 

Can you post a InDesign document that only contains the slug made from the table for testing purposes?

I just want to make sure I'm getting the correlating bleed settings into the correct cells.

 

Regards,

MIke

Votes

Translate

Translate

Report

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Hi Mike,

Thanks for the reply.

Here is the InDesign doc. Appreciate the help.

Votes

Translate

Translate

Report

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
Advisor ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Hello @Mayberry_Maybz 

 

Here you go...enjoy!!

 

 

// WORKING ON CURRENT DOCUMENT
var myDocument = app.activeDocument;

// INITIAL SETTINGS
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
myDocument.zeroPoint=[0,0];
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

// WORKING WITH ACTIVE PAGE
var currentPage = myDocument.layoutWindows[0].activePage;
var width, height; // SOME VARIABLES

// GETTING THE PAGE SIZES
width = currentPage.bounds[3] - currentPage.bounds[1];
height = currentPage.bounds[2] - currentPage.bounds[0];

// ROUND THE NUMBERS
var widthRounded = width.toFixed(2);
var heightRounded = height.toFixed(2);

var realHeight = heightRounded*10;
var realWidth = widthRounded*10;

var myLeftBleed = myDocument.documentPreferences.documentBleedInsideOrLeftOffset;
var myRightBleed = myDocument.documentPreferences.documentBleedOutsideOrRightOffset;
var myTopBleed = myDocument.documentPreferences.documentBleedTopOffset;
var myBottomBleed = myDocument.documentPreferences.documentBleedBottomOffset;

var ShowType;

// WORKING WITH TABLES ON THE ACTIVE PAGE
var myTables = app.layoutWindows[0].activePage.textFrames.everyItem().tables;

// show row and column of selected cell
//alert(app.selection[0].parentRow.index+"\n"+app.selection[0].parentColumn.index);

// CHECK IF THERE IS THE SLUG IN THE DOCUMENT
if(myTables.length>0)
{
ShowType = "ORG-GARTNER";
// PLACE THE SIZES IN THE SLUG
myTables[0].cells[12].contents = ("" + realWidth);
myTables[0].cells[13].contents = ("" + realHeight);
// PLACE THE BLEED SIZES IN THE SLUG
myTables[0].cells[15].contents = ("Left: " + myLeftBleed);
myTables[0].cells[16].contents = ("Right: " + myRightBleed);
myTables[0].cells[17].contents = ("Top: " + myTopBleed);
myTables[0].cells[18].contents = ("Bottom: " + myBottomBleed);
}

 

 

Oh yeah, I like chocolate glazed....

 

Regards,

Mike

Votes

Translate

Translate

Report

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Wow Mike, amazing work.

Now, I feel like i'm pushing it a bit but as the slug says, the document is at 10%. So when I use the script with your addition, it inputs the amount as is. I know there is part of the script for the page size that deals with this:

var realHeight = heightRounded*10;
var realWidth = widthRounded*10;

so is there a way to deal with this for the bleed? I've had a go, but with my limited knowledge, failed. The reason for this is exhibition graphics sometimes go waaaay past InDesigns page limit. I will use your answer for the other variations: 25% - 50% and 100%.

 

For Mike.gif

Much love

Maybz

Votes

Translate

Translate

Report

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
Advisor ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Hello @Mayberry_Maybz,

 

Sorry, I don't think I've had enough coffee yet with my donut. I'm not really sure on what you're asking for...

 

Regards,

Mike

Votes

Translate

Translate

Report

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Sorry my man,

In the template, the page size of the document is set up as 400mm x 250mm, but the script makes the slug entry 4000 x 2500 because the code above that has *10 multiplies by 10.

The new part you added for bleed enters the numbers at s/s so instead of saying 100mm bleed, it will enter the number as 10. I wondered if there was a way of applying that *10 to the bleed output to make the correct size show.

Hope that makes sense

Many thanks

Maybz

Votes

Translate

Translate

Report

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
Advisor ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

Hi @Mayberry_Maybz,

 

Give this a try....

// WORKING ON CURRENT DOCUMENT
var myDocument = app.activeDocument;

// INITIAL SETTINGS
myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;
myDocument.zeroPoint=[0,0];
myDocument.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.MILLIMETERS;
myDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS;

// WORKING WITH ACTIVE PAGE
var currentPage = myDocument.layoutWindows[0].activePage;
var width, height; // SOME VARIABLES

// GETTING THE PAGE SIZES
width = currentPage.bounds[3] - currentPage.bounds[1];
height = currentPage.bounds[2] - currentPage.bounds[0];

// ROUND THE NUMBERS
var widthRounded = width.toFixed(2);
var heightRounded = height.toFixed(2);

var realHeight = heightRounded*10;
var realWidth = widthRounded*10;

var myLeftBleed = myDocument.documentPreferences.documentBleedInsideOrLeftOffset*10;
var myRightBleed = myDocument.documentPreferences.documentBleedOutsideOrRightOffset*10;
var myTopBleed = myDocument.documentPreferences.documentBleedTopOffset*10;
var myBottomBleed = myDocument.documentPreferences.documentBleedBottomOffset*10;

var ShowType;

// WORKING WITH TABLES ON THE ACTIVE PAGE
var myTables = app.layoutWindows[0].activePage.textFrames.everyItem().tables;

// show row and column of selected cell
//alert(app.selection[0].parentRow.index+"\n"+app.selection[0].parentColumn.index);

// CHECK IF THERE IS THE SLUG IN THE DOCUMENT
if(myTables.length>0)
{
ShowType = "ORG-GARTNER";
// PLACE THE SIZES IN THE SLUG
myTables[0].cells[12].contents = ("" + realWidth);
myTables[0].cells[13].contents = ("" + realHeight);

// PLACE THE BLEED SIZES IN THE SLUG
myTables[0].cells[15].contents = ("Left: " + myLeftBleed);
myTables[0].cells[16].contents = ("Right: " + myRightBleed);
myTables[0].cells[17].contents = ("Top: " + myTopBleed);
myTables[0].cells[18].contents = ("Bottom: " + myBottomBleed);
}

Regards,

Mike

Votes

Translate

Translate

Report

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 ,
Aug 20, 2021 Aug 20, 2021

Copy link to clipboard

Copied

LATEST

You absolute ledge Mike.

 

Seriously spot-on. You have made my life immensely more productive. Honestly can't thank you enough.

 

Give this man a raise!

 

Thanks again.

Maybz

Votes

Translate

Translate

Report

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