Skip to main content
Known Participant
May 21, 2020
Answered

inDesign Import layers via Applescript

  • May 21, 2020
  • 1 reply
  • 771 views

Is it possible via Applescript to import specific layers from an Indesign into another?  I don't need to create the layers in InDesign. Basically, if the ID template contains 5 layers & I need only layers 3 & 4 to be imported into my document.
tell application "Adobe InDesign CC 2017"

   tell document 1
       -- I'm not sure if can be done or not
   end tell
end tell

The other idea I have will be to hide the layers I don't need from the template & leave the ones I need, select all & then copy into my document.  Any thoughts?
I found a javascript in another site that kind does I what I need but I would like to use Applescript since I know a little bit about it
Thank you

This topic has been closed for replies.
Correct answer BarlaeDC

Hi,

 

You should be able to do something like this:

 

tell application "Adobe InDesign 2020"
	set doc1 to document 1 -- document to copy from 
	set doc2 to document 2 -- document to copy to
	
	set allItems to every page item of doc1 whose name of item layer is "Layer 1" -- layer name to copy from
	
-- if you are wanting to keep them to specific pages you will need to sort the pages before you call the duplicate command
	set pageOne to page 1 of doc2 -- page to copy to
	duplicate allItems to pageOne
	
end tell

 

Hope this helps

Malcolm

1 reply

BarlaeDC
Community Expert
BarlaeDCCommunity ExpertCorrect answer
Community Expert
May 21, 2020

Hi,

 

You should be able to do something like this:

 

tell application "Adobe InDesign 2020"
	set doc1 to document 1 -- document to copy from 
	set doc2 to document 2 -- document to copy to
	
	set allItems to every page item of doc1 whose name of item layer is "Layer 1" -- layer name to copy from
	
-- if you are wanting to keep them to specific pages you will need to sort the pages before you call the duplicate command
	set pageOne to page 1 of doc2 -- page to copy to
	duplicate allItems to pageOne
	
end tell

 

Hope this helps

Malcolm

nrod2012Author
Known Participant
May 22, 2020

Thank you Malcolm for your help.  This is great but then I realized that in some documents I have more than 2 pages. If I  copy the 2 layers from the source document Master pages duplicate those into the master pages of the destination document then info that I need will be available in all the pages of the destination documents. Is that even possible?