Sunday, September 22, 2019

#1 2019-02-26 09:20:58 am

FredrikM
Member
From:: Förslöv, Sweden
Registered: 2019-02-19
Posts: 21

Get all links from one InDesign layer only.

I'm trying to get all linked images from a certain InDesign layer only.

To get all links in an InDesign document i use

Applescript:

set linksTotal to every link of document 1

and if i would like to get every link with a certain status this works fine.

Applescript:

set linksMissing to every link of document 1 whose status = link missing

But for a new project i would like to get every link of one InDesign layer only so i thought i could use something like this

Applescript:

set linksWebTotal to every link of document 1 whose item layer's name is WebLayer

But it does not seem to work, neither does

Applescript:

set linksWebTotal to every link of (layer WebLayer of document 1)

I'm out of ideas, here is a small test script if someone would like to try it out. You will need an InDesign document with two layers and one is labeled WebLinks and both layers need to have at least one image linked to it.

Applescript:


set WebLayer to "WebLinks"
tell application "Adobe InDesign CC 2017"
   set linksTotal to every link of document 1
   set linksWebTotal to every link of document 1 whose item layer's name is WebLayer
end tell

set linksTotalNr to count linksTotal
set linksWebTotalNr to count linksWebTotal

display dialog "Links total = " & linksTotalNr & return & "Links 4 web = " & linksWebTotalNr

Ps. I have also tried to hide all the other layers and get the links but it does not make any difference when scripting.

Last edited by FredrikM (2019-02-26 09:30:24 am)

Offline

 

#2 2019-02-26 12:56:33 pm

Budgie
Member
From:: New Zealand
Registered: 2005-02-22
Posts: 701

Re: Get all links from one InDesign layer only.

Hi
Try this

Applescript:

tell application id "com.adobe.InDesign"
   tell document 1
       set Links_ to page 1's every page item whose item layer's name is "WebLayer"
       select Links_
   end tell
end tell

Marc from this thread shows how to go about it:


Cheers
Budgie

"There's no shame in accepting aid from others... but perhaps there is a  responsibility."    - Batman

Offline

 

#3 2019-02-27 01:28:59 am

FredrikM
Member
From:: Förslöv, Sweden
Registered: 2019-02-19
Posts: 21

Re: Get all links from one InDesign layer only.

Hi Budgie.

Same result as with my own tries, zero links found.

Edit:
Sorry, it was to early in the morning for me, it seems to work.

Last edited by FredrikM (2019-02-27 02:35:08 am)

Offline

 

#4 2019-02-27 02:38:02 am

FredrikM
Member
From:: Förslöv, Sweden
Registered: 2019-02-19
Posts: 21

Re: Get all links from one InDesign layer only.

And it seems to work just fine like this also.

Applescript:

set linksWebTotal to every page item whose item layer's name is WebLayer

Offline

 

#5 2019-02-28 08:35:51 am

FredrikM
Member
From:: Förslöv, Sweden
Registered: 2019-02-19
Posts: 21

Re: Get all links from one InDesign layer only.

Seems that getting the page items is not the same as get links, so when continuing with the script where i need to get the name of the link and then relink it will not work. So i'm back to square one.

Offline

 

#6 2019-03-04 08:21:52 pm

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

Re: Get all links from one InDesign layer only.

Link is only useful in the document context. You want item link.
You can do this with a whose clause, as you requested...

Applescript:

tell application "Adobe InDesign CS3"'s document 1 to (page items whose item layer's name is "Weblink")'s all graphics's item link

It's easier and perhaps more efficient to target the layer directly:

Applescript:

tell application "Adobe InDesign CS3"'s document 1 to layer "WebLinks"'s all graphics's item link

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)