Need to get my FM11 styles under control
Robert Lauriston
robert at lauriston.com
Wed Mar 20 08:56:18 PDT 2013
Here's the ExtendScript I linked to earlier. The DeleteUnused...Fmt
functions would seem to make it pretty simple. You could maybe create
a giant scratch book containing all your .fm files and run the script
once.
http://help.adobe.com/en_US/framemaker/scripting/WSfbe285cf4bf3fffd-491bdbc212f9bbd97f1-7f1c.html
/*************************************************************************/
/*
*/
/* ADOBE SYSTEMS INCORPORATED
*/
/* Copyright 1986 - 2011 Adobe Systems Incorporated */
/* All Rights Reserved
*/
/*
*/
/* NOTICE: Adobe permits you to use, modify, and distribute this */
/* file in accordance with the terms of the Adobe license agreement */
/* accompanying it. If you have received this file from a source */
/* other than Adobe, then your use, modification, or distribution */
/* of it requires the prior written permission of Adobe.
*/
/*
*/
/**************************************************************************/
/*
* Program Name:
* << delete unused formats >>
*
* Author:
* Vikash Kumar (vikash at adobe.com)
*
* General Description:
* This script deletes all the unused table, paragraph and
character formats in a book
*
**************************************************************************/
book = app.ActiveBook
bookTraverse(book)
function bookTraverse(book)
{
if (!book.ObjectValid() )
{
Alert ("No Active book" ,Constants.FF_ALERT_CONTINUE_WARN)
return
}
var ret = Alert ("All the files in the book will be modified and
saved: Press <OK> to continue or <cancel> to
abort",Constants.FF_ALERT_OK_DEFAULT)
if (ret == -1)
{
return
}
var compBook = book.FirstComponentInBook
while(compBook.ObjectValid() )
{
var compName = compBook.Name
var compType = compBook.BookComponentFileType
var doc = open(compName)
if (compType == Constants.FV_BK_BOOK)
{
bookTraverse (doc)
}
if (doc.ObjectValid() )
{
deletefromdoc (doc)
saveDoc (doc, doc.Name)
doc.Close (1)
}
compBook = compBook.NextBookComponentInDFSOrder
}
Alert ("Operation finished" ,Constants.FF_ALERT_CONTINUE_WARN)
}
function deletefromdoc(doc)
{
doc.DeleteUnusedTblFmt()
doc.DeleteUnusedPgfFmt()
doc.DeleteUnusedCharFmt()
}
function open(filename)
{
var openProp = GetOpenDefaultParams()
var 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
i=GetPropIndex(openProp,Constants.FS_LockCantBeReset)
openProp[i].propVal.ival=Constants.FV_DoOK
i=GetPropIndex(openProp,Constants.FS_MakeVisible)
openProp[i].propVal.ival=false
var retParm = new PropVals()
var fileObj=Open(filename,openProp,retParm);
return fileObj
}
function saveDoc(file,mifName) {
var params = GetSaveDefaultParams()
var returnParamsp =new PropVals()
var i = GetPropIndex(params, Constants.FS_FileType)
params[i].propVal.ival =Constants.FV_SaveFmtBinary
//doc2save = SimpleOpen("D:\\extendscript\\myScripts\\tfiles\\SimpleOpen.fm",0);
file.Save(mifName, params, returnParamsp)
return
}
More information about the framers
mailing list