Monday, May 25, 2020

#1 2020-05-21 02:32:26 am

nellbern
Member
Registered: 2007-01-16
Posts: 132

Import layers

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.

Applescript:

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

AppleScript: 2.11 (203.1)
Browser: Safari 537.36
Operating System: macOS 10.14

Last edited by nellbern (2020-05-21 02:51:42 am)

Offline

 

#2 2020-05-22 06:22:51 am

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 944

Re: Import layers

Hi. You can't import a layer—or any other page object. You could save multiple template copies and remove layers, or you could duplicate objects on layers across documents.

Applescript:

tell application "Adobe InDesign CS3"    
   duplicate document 1's layer 3's page items to document 2's layer 3 --assumes open documents with at least 3 layers
end tell

Offline

 

#3 2020-05-22 02:05:39 pm

nellbern
Member
Registered: 2007-01-16
Posts: 132

Re: Import layers

As always thank you MarcAnthony for the clarification. Duplicate items are the way to go. I'm trying a different approach. So if I get the layers/items from the template & then, in this case, duplicate/copy the items into the master pages of the destination documents that way will be available in all the pages, will that be possible? The below works  & it is putting everything on the first 2 pages of the document.

Applescript:

tell application id "com.adobe.indesign"
   set source1 to document 1 -- copy from
   set destination2 to document 2 -- to copy to
   
   set ALLItems to every page item of source1 whose name of item layer is "L2" -- layer name to copy from
   set THEpage to page 1 of destination2 -- page to copy to
   duplicate ALLItems to THEpage
   
   set ALLItems to every page item of source1 whose name of item layer is "L3" -- the other layer name to copy from
   set THEpage to page 1 of destination2 -- page to copy to
   duplicate ALLItems to THEpage
end tell

So if I change it to do the same but in the master pages I get an error 1728

Applescript:

tell application id "com.adobe.indesign"
   set source1 to document 1 -- copy from
   set destination2 to document 2 -- to copy to
   
   set ALLItems to every item of master page items of source1 whose name of item layer is "L2" -- layer name to copy from
   set THEpage to page 1 of destination2 -- page to copy to
   duplicate ALLItems to THEpage
   
   set ALLItems to every item of master page items of source1 whose name of item layer is "L3" -- the other layer name to copy from
   set THEpage to page 1 of destination2 -- page to copy to
   duplicate ALLItems to THEpage
end tell

Model: iMac (Retina 5K, 27-inch, Late 2015)
Browser: Safari 537.36
Operating System: macOS 10.14

Last edited by nellbern (2020-05-22 02:07:30 pm)

Offline

 

#4 2020-05-22 06:23:14 pm

Marc Anthony
Member
From:: Dallas, TX
Registered: 2006-04-27
Posts: 944

Re: Import layers

Master page items belong to specific pages. Master spreads are owned by the document. Should you have multiple page/spread targets, you'll need to loop and adjust the target's indexes.

Applescript:

tell application id "com.adobe.indesign"
   duplicate (document 1's master spread 1's page items whose item layer's name is "L2") to document 2's master spread 1
   duplicate (document 1's master spread 1's page items whose item layer's name is "L3") to document 2's master spread 1
end tell

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)