Hi, I am new to Extendscript and Framemaker. I am trying to cycle through a book and find which paragraphs are/contain anchored frames. If they contain an anchored frame, I want to be able to select the paragraph and apply/remove conditional tags on the paragraph.
This is what I have so far:
//code to Show All conditions including hidden ones in book.
//take the object of the active book
var openedBook = app.ActiveBook;
//function call - defiend below
openBookFiles(openedBook);
function openBookFiles(openedBook)
{
var bookChapter = openedBook.FirstComponentInBook;
var counter = 0;
if(bookChapter.ObjectValid())
{
var chapterId = bookChapter.id;
while (chapterId)
{
var chapterName = bookChapter.Name;
chapterId = openFile(chapterName);
var msg = "Opened Chapter " + chapterName + "Component #"+ counter + "\n\n";
alert(msg);
counter++;
bookChapter.ComponentIsSelected = true;
chapterId.ShowAll = 1;
bookChapter = bookChapter.NextComponentInBook;
chapterId = bookChapter.id;
}
}
//code to find all paragraphs in book, check to see if they are/contain anchored frames or not.
var mainflow = doc.MainFlowInDoc;
var tframe = mainflow.FirstTextFrameInFlow;
var pgf = tframe.FirstPgf;
while (pgf.ObjectValid())
{
//find out if the paragraph is/contains an anchored frame
//if it does, deslect/select a condition tag applied on the paragraph.
pgf = pgf.NextPgfInFlow;
}
}