How to Set Up Default Layers for Every New InDesign File
Copy link to clipboard
Copied
Hi,
Is it possible to create every new Indesign file with the same set of layers?
(Like you can add "default" swatches to every new indesign by making these with no open files)
Basically I would like every new file to have 3 layers by default: Diecut / images / design (f.ex.)
Tx
kind regards
vanessa
<Title renamed by MOD>
Copy link to clipboard
Copied
Hi @OutlineG,
Thank you for reaching out!
Yes, creating new InDesign files with a set of default layers is possible. To achieve this, you can create a template with your desired layers and save it for future use. Here’s a quick guide:
1. Open InDesign and create a new document with the layers you want (e.g., Diecut, Images, Design).
2. Go to the Layers panel (Window > Layers) and create the needed layers.
3. Go to File > Save As, and choose "InDesign Template" (.indt) from the file format options. This will save your file as a template with all your layers in place.
In the future, when you need a new document, simply open this template, and your layers will be ready to go!
If you have any more questions or need further assistance, feel free to ask.
Thank you,
Abhishek Rao
Copy link to clipboard
Copied
Hi @OutlineG ,
this could be done with an ExtendScript (JavaScript) script that reacts on the "afterNew" event, fetches the new document and adds new layers to every new document on the fly.
When executed from the User folder in the Scripts panel of InDesign, the code below will add two layers in every new InDesign document until you quit InDesign:
#targetengine addLayersAfterNew
var listenerName = "addLayersAfterNew";
var myEventListener = app.eventListeners.itemByName(listenerName);
// Toggle. If already there, remove the event listener and add it again:
if(myEventListener.isValid){ myEventListener.remove() );
// Toggle. If not there, add:
myEventListener = app.addEventListener( "afterNew", addLayersAfterNew, false );
myEventListener.name = listenerName;
function addLayersAfterNew( evt )
{
var doc = evt.parent;
doc.layers.add
(
{
layerColor : UIColors.GOLD ,
name : "New Layer 1"
}
);
doc.layers.add
(
{
layerColor : UIColors.MAGENTA ,
name : "New Layer 2"
}
);
};
Copy the code to an unformatted text file and save it with the suffix *.jsx.
How to install the script file see:
https://indiscripts.com/pages/help#hd0sb2
https://www.danrodney.com/scripts/directions-installingscripts.html
If you want a more permanent solution so that InDesign loads the script's code every time after starting automatically, you have to put the script file in a folder named startup scripts in the parent folder of the Scripts Panel folder on your machine. You'll find the Scripts Panel folder when you select the User folder in your Scripts panel of your InDesign and execute the menu command for Show in Finder on a Mac or Show in Explorer on a Windows machine.
All possible values* for layerColor are listed at:
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#UIColors.html#d1e87840
Change the name of a given folder by changing "New Layer 1" to something different.
Note: A layer name in a given InDesign document must be unique. Some characters cannot be used for a name. For example, a layer's name must not start with character [ and must not end with ] .
* It's also possible to use a triplet of RGB values like:
layerColor : [255,0,0]
Regards,
Uwe Laubender
( Adobe Community Expert )
PS EDITED THE SCRIPT
Copy link to clipboard
Copied
NOTE: I edited the script for the usage with a startup scripts folder.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hm. If you find the script more useful not to be executed with a startup scripts folder and instead you want to toggle its functionality to add new folders on and off without quitting InDesign then use the following code and execute it again to turn off its functionality:
#targetengine addLayersAfterNew
var listenerName = "addLayersAfterNew";
var myEventListener = app.eventListeners.itemByName(listenerName);
// Toggle. If already there, remove and exit script:
if(myEventListener.isValid){ myEventListener.remove() ; alert(listenerName+"\r"+"removed."); exit() };
// Toggle. If not there, add:
myEventListener = app.addEventListener( "afterNew", addLayersAfterNew, false );
myEventListener.name = listenerName;
function addLayersAfterNew( evt )
{
var doc = evt.parent;
doc.layers.add
(
{
layerColor : UIColors.GOLD ,
name : "New Layer 1"
}
);
doc.layers.add
(
{
layerColor : UIColors.MAGENTA ,
name : "New Layer 2"
}
);
};
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
I get a error on line 10 - can' t figure out what it s referring to - and might be something I do wrong 😉
Copy link to clipboard
Copied
Hi @OutlineG ,
make sure that you copy only the code text!
To a text only file. No text formatting allowed!
See how to save script code for ExtendScript (JavaScript):
https://indiscripts.com/pages/help#hd0sb2
https://www.danrodney.com/scripts/directions-installingscripts.html
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
hmmm I used textedit - didn't know what elke to use - without coding - i think... 😕
Copy link to clipboard
Copied
In TextEdit you could toggle between formatted text and unformatted text with
CMD + SHIFT + T
I'd try that first.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
@OutlineG said: "… I get a error on line 10 - can' t figure out what it s referring to - and might be something I do wrong"
Well, see the script file that I attached with this answer:
addLayersAfterNew.jsx.txt
Because file types like *.jsx are not supported here in the InDesign forum I simply added a .txt to its name.
Rename the script and remove the .txt at the end of the file name before you install the script file. (Well, I hope that you have enabled to see file suffixes in the Finder of your Mac…)
The code is from this reply:
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hi Uwe,
I installed the attached script, restarted Indesign just in case - but when I run it nothing happens. I do get a warning (see screenshot) but either option does nothing. Is that the "toggle" you were refurring to?
(thanks for bearing with me ;/)
Vanessa
Copy link to clipboard
Copied
Hi Vanessa,
hm. That's strange…
Tested the script with my German InDesign 2024 version 19.5.0 on a MacBook Pro with macOS 12.7.1 and cannot see this error.
Cannot tell if I can help you, but please share a screenshot of your Scripts panel with the script file visible in the User folder of the Scripts panel. What's your exact version of InDesign? What's the version of your operating system?
What happens after a retart of InDesign if you execute the script only once with the menu command you'll find in the hamburger menu of the Scripts panel?
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Hi Uwe,
Mac - Sonoma 14.6.1
Indesign 2024
what I did to install it is "show in finder" of another script and place it there.
After restart: if I run it once: nothing happens // if I run it again: screenshot 2
Tx!
Vanessa
Copy link to clipboard
Copied
Ah.
The first time you ran the script the function was turned on to add layers with every new document.
Without showing any alert that the function is on.
The second time the script will turn off this functionality.
With an alert message like you see in one of your screenshots.
So when this alert message comes up, simply run the script again once.
Then create a new document. The new layers should be added to the new document.
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
URGLLLL I have NO idea what I'm doing. It's not working whether I restart / re-install / toggle on or off / the only thing I do get after toggling is no extra layers OR the screenshot attached. I'm about to give up... 😞
Copy link to clipboard
Copied
Hi Uwe, works fine (last Layer in the scripts is first Layer in the panel, so had to tweak that) but if I use a Layer on top for Parent page items, I like the second layer (text) to be targeted as active, is there a way to add that to this script?
Copy link to clipboard
Copied
Hi Frans,
yes, you can define the active layer like that:
doc.activeLayer = doc.layers.itemByName("New Layer 1");
Regards,
Uwe Laubender
( Adobe Community Expert )
Copy link to clipboard
Copied
Thanks Uwe 👍
That works and sets the layer. We still have the standard layer however present, 'Layer 1' (or in Dutch 'Laag 1') that I would like to delete, is there any delete layer by name I can add? Thanks!
Copy link to clipboard
Copied
You can set many document parameters and style aspects by setting them with no document open — if thre's no doc, setting the color to red will make red the default color for all new documents. There's quite a few things you can set this way, and doing so accidentally is a common cause of questions — "Why do all of my new text boxes have a black border?"
Unfortunately... layers seem to be a document-specific element and can't be preset in this manner. The best you could do is create a document template. (Set up a "perfect" blank doc with all elements, settings and parameters, then save it in INDT format. The main thing that extension does is force you to save the file in INDD format under a new name and location so that you don't overwrite the template.)
Copy link to clipboard
Copied
i still use this:
https://indisnip.wordpress.com/2011/02/25/script-tomaxxilayers®-add-layer-sets-to-document/
but not sure if it is still available for download...
EDIT: nope, downloadlink is dead...
Copy link to clipboard
Copied
Create a file with all layers and save as InDesign Template INDT. To create a new file open the template file.

