Dear all,
I am very new at scripting for framemaker (and a complete novice at JavaScripting) and I find it a bit hard to find information in an environment I'm not familiar in. Maybe you can help me out.
What I would like to do:
I would like to be able to modify the master pages, page layouts, paragraph formats and character formats in the first document of a book and then initiate the script, which will
- import the master pages and formats from the first document into all the other documents (just like if you go via File > Import > Format),
- update the book.
In the example scripts folder in the installation folder, I have found an example script that goes through all the documents in a book:
book=app.ActiveBook;
comp=book.FirstComponentInBook;
while(comp.ObjectValid())
{
open(comp.Name);
nextComp=comp.NextBookComponentInDFSOrder;
prevComp=comp.PrevBookComponentInDFSOrder;
compType=comp.BookComponentFileType;
Log("BookComponent.log", "CompName-"+comp.Name);
Log("BookComponent.log", "comp File Type-"+compType);
Log("BookComponent.log", "Component Type(Fldr,Grp,file)-"+comp.ComponentType);
Log("BookComponent.log", "PreviousCompName-"+prevComp.Name);
Log("BookComponent.log", "nextCompName-"+nextComp.Name);
Log("BookComponent.log", "---------------------------------");
//process component here//
comp=nextComp;
}
function open(filename)
{
openProp = GetOpenDefaultParams()
i=GetPropIndex(openProp,Constants.FS_FileIsOldVersion)
openProp[i].propVal.ival=Constants.FV_DoOK
i=GetPropIndex(openProp,Constants.FS_FontNotFoundInCatalog)
openProp[i].propVal.ival=Constants.FV_DoOK
i=GetPropIndex(openProp,Constants.FS_FontNotFoundInDoc)
openProp[i].propVal.ival=Constants.FV_DoOK
i=GetPropIndex(openProp,Constants.FS_FileIsInUse)
openProp[i].propVal.ival=Constants.FV_DoCancel
i=GetPropIndex(openProp,Constants.FS_AlertUserAboutFailure)
openProp[i].propVal.ival=Constants.FV_DoCancel
retParm = new PropVals()
docOpen=Open(filename,openProp,retParm);
return docOpen;
}
function Log(logFile,textLine)
{
file=new File ("C:\\ESLog\\"+logFile);
file.open("a+", "TEXT", "????");
file.write(textLine+"\r");
file.close();
}
That gets me started a bit. I have also seen the line //process component here//, and I am a bit familiar with programming and scripting. I somehow see how this works in principle. But then I am at a loss.
I know that there's a lot of documentation on FrameMaker scripting (I have the scripting guide). But I find it hard to find the corresponding information without spending hours of learning.
Could someone help me out?
Immense gratitude in advance!
Matthias