Indesign duplicate items on master page into another master page doc
I need to import specific layers from a template into lots of documents. The source template contains 5 layers but I need only the items on layers 2 & 3 to be duplicated or (paste in place) into Master A-Plates page of the destination documents. The script below indeed works but it is duplicating the items of layers2 &3 on the pages. I need them to be in the Master page A-Plates of the destination document so that way they are available when a new page is added.
tell application "Adobe InDesign 2017"
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 "Layer2"
-- layer name to copy from
set pageOne to page 1 of doc2
-- page to copy to
duplicate allItems to pageOne
set allItems to every page item of doc1 whose name of item layer is "Layer3"
-- layer name to copy from
set pageOne to page 1 of doc2
-- page to copy to
duplicate allItems to pageOne
end tell
I modified the script to do the same but on the master page but no luck. Any suggestions?
tell application "Adobe InDesign CC 2017"
set doc1 to document 1 -- document to copy from
set doc2 to document 2 -- document to copy to
set allItems to every item of master page items of doc1 whose name of item layer is "layer2" -- layer name to copy from
set pageOne to page 1 of doc2 -- page to copy to
duplicate allItems to pageOne
set allItems to every item of master page items of doc1 whose name of item layer is "layer3" -- layer name to copy from
set pageOne to page 1 of doc2 -- page to copy to
duplicate allItems to pageOne
end tell
