Getting to the previous paragraph
Hello there,
what I want to do is to iterate through all frames with pictures in my doc. While going through I want to save the file name of the picture in a variable, then delete the frame with the picture and append the file name of the picture to the end of the paragraph that was above the frame with the picture.
What I got so far is this:
var doc= app.ActiveDoc;
var count = 0;
var graphicPath;
CountGraphics(doc);
DeleteGraphics(doc);
//COUNT GRAPHICS
function CountGraphics(doc)
{
var graphic = doc.FirstGraphicInDoc;
while (graphic) {
if (graphic.type == Constants.FO_Inset) {
count++;
}
graphic = graphic.NextGraphicInDoc;
}
}
//DELETE GRAPHICS + FRAMES
function DeleteGraphics(doc)
{
for(i = 0; i < count; i++) {
var graphic = doc.FirstGraphicInDoc;
while (graphic) {
if (graphic.type == Constants.FO_Inset) {
graphicPath = graphic.InsetFile;
graphic.FrameParent.Delete();
}
graphic = graphic.NextGraphicInDoc;
}
}
}This works so far for the saving file name and deleting of the frames.
What I am stuck on is the part to select the previous paragraph and go to the end of it to write the file name of the graphic to it.
So like within the the loop I want to catch the previous paragraph of the frame I am at at the moment.
Thought about something like "graphic.FrameParent.PrevPgfInFlow" or sth...
Thanks in advance for dealing with my stuff ^^°
