The inserted graph is converted by path. How to apply an object style directly?
Hi Sunil Yadav.
I'm sorry.
I missed you and didn't reply in time.
The script provided by you can insert the path in the text containing @d:\pic\a.jpg@ directly into the image.
But when the picture is too large, the text box will be too wide to display.
How to apply an object style to an imported graph directly? For example, "mypic" object style.
So I can use mypic to control the position and size of the image.
Thank you very much.
---------------------------------------------------------------
Here's the script you provided
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();
}


