Hi;
I just started working with Framemaker scripting this afternoon and using sample scripts here I've got the main skeleton of my program complete. I know that a similar script was posted here years ago to move markers to the start of words, but the script appears to have vanished and the one I'm working on needs to move the markers to the beginning of the paragraph that they're currently residing in (it help translation immensely).
So far my program opens a book and, one chapter at at time, finds all of the Index markers. I need to move those markers, but I don't have enough of a handle on the language yet to get it working.
The key function is here:
function moveMarker(doc, mrkType, pgf, offset)
{
if (!doc.ObjectValid() )
{
return;
}
mrker = doc.FirstMarkerInDoc;
while (mrker.ObjectValid() )
{
if (mrker.MarkerTypeId.Name == mrkType)
{
var str1 = mrker.MarkerText;
/* A quick test to confirm it's finding the Index markers */
$.writeln(str1);
cnt ++;
/*
A counter to check how many Index markers it's finding
in the whole book -- will need a counter for number in each paragraph
to use as the offset from beginning of each paragraph
*/
$.writeln(cnt);
}
mrker = mrker.NextMarkerInDoc;
}
}
My thoughts are to start each paragraph with a paragraph-counter (p-counter) set to "0"; once the script finds an Index marker, it should cut the marker, then past it to the start of the paragraph using the p-counter as the offset, then increment the p-counter (that way it should always paste the marker after the last one -- so it won't re-find the markers it's already found).
The main script currently starts with the first Index marker in a document and, when it hits the end of a document, moves to the next document in a book -- I know I'll need to have it start with the first paragraph in a chapter and track paragraphs as it goes.
Any suggestions on how best to do the cut--and-paste, as well last track the paragraph the marker is in?
Any help would be greatly appreciated.
Thanks,
Walt Sterdan