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

Can you convert the text in word into a path and insert the picture?

Enthusiast ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

There are a lot of illustrations in word, and it is difficult to find the position if they are to be included in InDesign.
Is there a way to directly convert some specific text in word into the path of the picture and insert it?
For example, there is a text like this:
-------------------------------------------------- --------------------------------------------------
In the United States, which is mired in multiple crises such as the new crown epidemic, economic recession, and racial issues, political polarization and social division have worsened during the election year, with frequent demonstrations, protests, conflicts, and riots.
@ D:\Mybook\abc\001. election.PSD@@
Election day on November 3 is imminent, and general election-related disputes such as mail voting may add another "fuse." American scholar Francis Fukuyama recently wrote an article worrying that "the United States may be experiencing a major crisis related to the election itself."
-------------------------------------------------- --------------------------------------------------

Can the picture pointed to by @ D:\Mybook\abc\001. election.PSD@ be inserted into this position automatically?

If it can be realized, multi-picture typesetting would be too much trouble...

TOPICS
Bug , Feature request , How to , Import and export , Scripting

Views

464

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

Advocate , Nov 02, 2020 Nov 02, 2020

Try this code sample:

//////////////////////////////////////////////////////////////////////////////////////////////////////
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "(?<=@)([^@]+)(?=@)";
var allFound = app.documents[0].findGrep();
for(var i = 0; i < allFound.length; i){
    var allContent = allFound[i].texts[0].contents;
    var filePath = File(allContent.toString().replace(/[\s]+/g,'').replace(/\\/g,'/'))
...

Votes

Translate

Translate
Community Expert ,
Nov 01, 2020 Nov 01, 2020

Copy link to clipboard

Copied

Perhaps with scripting (but I'm not a script writer). Definitely it's not built into InDesign's native abilities.

 

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 ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

Hi,

it seems that a script originally written by Peter Kahrel and adapted by Kasyan Servetsky could do what you want:

 

Place inline images

Script for InDesign: tested in CC 2015.4

This script It finds text between two @ characters – e.g. @Deleted User.tif@ – and replaces it with the image that has the same name. The original script was written by Peter Kahrel. I found it somewhere on the Adobe scripting forum and reworked it to my liking.

http://kasyan.ho.ua/indesign/image/place_inline_images.html

 

Regards,
Uwe Laubender

( ACP )

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
Enthusiast ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Where is the picture?

It should include the image path.

Because the pictures don't have to be in the links folder. At the beginning, the pictures are classified by customers, which should be followed. Finally, it will be collected under links

 

And the image should also apply the object style, for example, "myimg" object style

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
Advocate ,
Nov 02, 2020 Nov 02, 2020

Copy link to clipboard

Copied

Try this code sample:

//////////////////////////////////////////////////////////////////////////////////////////////////////
app.findGrepPreferences = NothingEnum.nothing;
app.changeGrepPreferences = NothingEnum.nothing;
app.findGrepPreferences.findWhat = "(?<=@)([^@]+)(?=@)";
var allFound = app.documents[0].findGrep();
for(var i = 0; i < allFound.length; i){
    var allContent = allFound[i].texts[0].contents;
    var filePath = File(allContent.toString().replace(/[\s]+/g,'').replace(/\\/g,'/'));
    if(filePath.exists){
        if(allFound[i].insertionPoints[0].parent.characters[allFound[i].texts[0].characters[-1].index+1].contents == "@"){
            allFound[i].insertionPoints[0].parent.characters[allFound[i].texts[0].characters[-1].index+1].contents = "";
            app.documents[0].recompose();
            }
        allFound[i].texts[0].contents = "";
        allFound[i].texts[0].insertionPoints[0].place(filePath);
        if(allFound[i].insertionPoints[0].parent.characters[allFound[i].texts[0].characters[0].index-1].contents == "@"){
            allFound[i].insertionPoints[0].parent.characters[allFound[i].texts[0].characters[0].index-1].contents = "";
            app.documents[0].recompose();
            }
        }
    else{
        i++;
        }
    app.documents[0].recompose();
    var allFound = app.documents[0].findGrep();
    }

//////////////////////////////////////////////////////////////////////////////////////////////////////

Best

Sunil

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
Enthusiast ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Where is the picture?

It should include the image path.(For example, D: \mybook-1\originalfile\ pic01\001.tif)

 

Because the pictures don't have to be in the links folder. At the beginning, the pictures are classified by customers, which should be followed. Finally, it will be collected under links

 

And the image should also apply the object style, for example, "myimg" object style

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
Enthusiast ,
Apr 03, 2021 Apr 03, 2021

Copy link to clipboard

Copied

LATEST

This script can import a picture, but the picture is too large and the text box is stretched too wide, so the picture cannot be displayed.
Is it possible to customize an object style for imported pictures, such as: "mypic"

 

bok25.jpg

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