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

File path in text to linked image

Community Beginner ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Is there a way to find and replace image path in a text or table with a linked images in InDesign.

I have a database with the products and the path to the barcodes image,
When copied into InDesing I then need the image paths to be replace with a linked images.
e.g. ./Barcode/9341215001038.png
Mail merge is not an option for versos reasons for this project.

TOPICS
How to , Scripting

Views

245

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 Beginner , Mar 02, 2021 Mar 02, 2021

Thanks for your reply, I feared it would not be trivail, as I coudnt find any scripts.
Idealy the text from the databse is place in a table witht the last column beeing the barcodes path, the images are to replace the text path and be place inside the cell, fitting within the cells width and/or height.

Votes

Translate

Translate
Community Expert ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Short answer: yes, there is likely a way. Long answer: you would need a lot more details (how big should the images be, fitting options, other corner cases) before we could begin to help but it's not exactly a trivial task. 

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 Beginner ,
Mar 02, 2021 Mar 02, 2021

Copy link to clipboard

Copied

Thanks for your reply, I feared it would not be trivail, as I coudnt find any scripts.
Idealy the text from the databse is place in a table witht the last column beeing the barcodes path, the images are to replace the text path and be place inside the cell, fitting within the cells width and/or height.

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 ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

Rudimentarily, with a textframe containing the table selected: 

 

var table = app.selection[0].tables[0];
var rows = table.rows.everyItem().getElements();
var lastCell, lcContents;
for (var i = 0; i < rows.length; i++) {
    lastCell = rows[i].cells[-1];
    lcContents = lastCell.contents;
    lastCell.contents = "";
    lastCell.convertCellType(CellTypeEnum.GRAPHIC_TYPE_CELL);
    lastCell.rectangles[0].place(File(lcContents));
}

 

 Lots of pitfalls. Place won't work if cell is overset. This assumes the cell contains the complete path. Not sure if the cell dimensions would change in the conversion. Will require some finetuning. 

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 Beginner ,
Mar 03, 2021 Mar 03, 2021

Copy link to clipboard

Copied

LATEST

thanks heaps,

It didnt work out of the box, but with a little finetuning I'm sure I can get it to work. you have showed me the way.

I admire how you managed to condence to code, its beautiful

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