Here is an AppleScript to create layers automatically in InDesign

Whenever I start a new document in InDesign, I always like to build the following layers by default (in this order):

  • Foreground
  • Text
  • Object
  • Graphic
  • Background

Layers help you toggle your visibility, make quick adjustments, and easier selections when locked down. And of course, your documents are tame and organized (not stuck on Layer 1). Creating the layers manually was a tedious process. I did some research and wrote a quick script to do exactly that.

Create the file and place it in your InDesign Scripts folder.

Here is the source (it may need updating for newer versions of InDesign):

tell application "Adobe InDesign"
   set LayerName to "Background"
   tell document 1
      -- Is this layer is exist ?
      try
         set myLayer to layer LayerName
         -- No? -> create it
      on error
         set myLayer to make layer with properties {name:LayerName}
      end try
   end tell 
   set LayerName to "Graphic"
   tell document 1
      -- Is this layer is exist ?
      try
         set myLayer to layer LayerName
         -- No? -> create it
      on error
         set myLayer to make layer with properties {name:LayerName}
      end try
   end tell 
   set LayerName to "Object"
   tell document 1
      -- Is this layer is exist ?
      try
         set myLayer to layer LayerName
         -- No? -> create it
      on error
         set myLayer to make layer with properties {name:LayerName}
      end try
   end tell 
   set LayerName to "Text"
   tell document 1
      -- Is this layer is exist ?
      try
         set myLayer to layer LayerName
         -- No? -> create it
      on error
         set myLayer to make layer with properties {name:LayerName}
      end try
   end tell 
   set LayerName to "Foreground"
   tell document 1
      -- Is this layer is exist ?
      try
         set myLayer to layer LayerName
         -- No? -> create it
      on error
         set myLayer to make layer with properties {name:LayerName}
      end try
   end tell 

end tell

This definitely scratched my itch. Sometimes the simplest tools are the most satisfying (as usual, Dr. Drang nails it).