• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get the file path of all placed linked files on the page include those within groups

Community Beginner ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

The following allows gets the file paths of all pageItems where item.hasOwnProperty("graphics")

However, this does not get the file paths for the frames that are within a group on that page.


How can we resolve this? 
Any suggestions or insight would be appreciated. Thank you.

var doc = app.activeDocument;
var viewportBounds = app.activeWindow.activePage.bounds;
var viewportElements = app.activeWindow.activePage.getElements(viewportBounds);
var filePaths = [];
var modifiedFilePaths = [];
var page = app.activeWindow.activePage;
for (var i = 0; i < page.pageItems.length; i++) {
    var item = page.pageItems[i];
    if (item.hasOwnProperty("graphics")) {
        for (var j = 0; j < item.graphics.length; j++) {
            var graphic = item.graphics[j];
            var filePath = graphic.itemLink.filePath;
            // check if file path is already in the array
            if(!filePaths[filePath]) {
                filePaths[filePath] = true;

 

TOPICS
Scripting

Views

258

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Jan 14, 2023 Jan 14, 2023

Iterate through page.allPageItems instead of just page.pageItems;

 

The alternative is to write your own recursive func, but that's what allPageItems is for. 

Votes

Translate

Translate
Community Expert ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

Iterate through page.allPageItems instead of just page.pageItems;

 

The alternative is to write your own recursive func, but that's what allPageItems is for. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

Hi @SnowDPD , Another option might be to loop through the links and check the linked graphic’s  parentPage:

 

 

var lnks = app.activeDocument.links;
var ap = app.activeWindow.activePage;

for (var i = 0; i < lnks.length; i++){
    if (lnks[i].parent.parentPage == ap && lnks[i].parent.hasOwnProperty("graphics")) {
        $.writeln(lnks[i].filePath)
    }
};

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 14, 2023 Jan 14, 2023

Copy link to clipboard

Copied

Open links panel, add filepath column, set shortcut for: get all information from links panel. Done. 

#miNerikejZeToNejde

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 16, 2023 Jan 16, 2023

Copy link to clipboard

Copied

LATEST

Hi together,

how about using this array:

page.allGraphics

Of course you have to check for property itemLink, because with copy/pasted graphics from e.g.an open PhotoShop image selected this should throw an error.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines