I am in the large format printing industry and could use an expert in Applescript’s help.
We need to put a trim box on every InDesign page we export out for printing with a stroked rectangle on the trim size so that when we put that PDF into an imposition for printing, our digital cutter will use that box to trim the printed piece.
I have a script that will draw the box on the trim but it uses the width and height from the document setup.
Is there any way that I can either have the box drawn using the information that comes from the Page Tool or have the information from the Page Tool changed to the width and height in the document setup.
Most of the designers use the Page Tool to change the size of the document rather than document setup so they can have multiple sized documents in one InDesign file.
Any help would be greatly appreciated since this is becoming a very time consuming part of my day.
Depending on how your existing script is structured, you just need to use the bounds of each individual page to draw your box rather than the dimensions of the document.
If you want to post the details of the existing script it should be easy enough to show how to change it.
tell application “Adobe InDesign 2025”
set myDocument to active document
set PWidth to page width of document preferences of myDocument
set PHeight to page height of document preferences of myDocument
set PWSize to PWidth + 0.0139
set PHSize to PHeight + 0.0139
set PHString to ((PHSize) as real)
set PWString to ((PWSize) as real)
tell document 1 to make new color with properties {space:CMYK, color value:{100, 100, 0, 0}, name:“CutContour”, model:spot}
–Create a layer named “CutContour”.
set LayerName to “CutContour”
tell myDocument
try
set myLayer to layer LayerName
on error
set myLayer to make layer with properties {name:LayerName, printable:true, layer color:red}
end try
end tell
tell active document
set PageCount to count of pages
repeat with i from 1 to PageCount by 1
tell page i
make rectangle with properties {geometric bounds:¬
{“0 in”, “0 in”, PHeight, PWidth}, fill color:“None”, stroke color:“CutContour”, stroke weight:1, overprint stroke:false}
end tell
end repeat
end tell
(I’ve ignored whther the stroke on the box should be inside, centred or outside aligned.)
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
tell application id "com.adobe.InDesign"
activate
set myDocument to active document
tell myDocument
tell view preferences
set ruler origin to spread origin
end tell
end tell
try
tell myDocument to make new color with properties {space:CMYK, color value:{100, 100, 0, 0}, name:"CutContour", model:spot}
end try
-- Create a layer named "CutContour".
set LayerName to "CutContour"
tell myDocument
try
set myLayer to layer LayerName
on error
set myLayer to make layer with properties {name:"CutContour", printable:true, layer color:red}
end try
end tell
tell active document
set PageCount to count of pages
repeat with i from 1 to PageCount by 1
tell page i
set {y1, x1, y2, x2} to bounds
make rectangle with properties {geometric bounds:¬
{y1, x1, y2, x2}, fill color:"None", stroke color:"CutContour", stroke weight:1, overprint stroke:false}
end tell
end repeat
end tell
end tell