Quantcast
Channel: Adobe Community : All Content - FrameMaker Scripting
Viewing all articles
Browse latest Browse all 888

Verify References in a Ditamap - ExtendScript

$
0
0

Hi Folks,

 

I wrote a script to verify if all the files referenced in a ditamap exist. The script is rather slow when the a ditamap refers to other ditamaps because the script opens those ditamaps.

 

var doc = app.FirstOpenDoc;

CheckDITATopicref(doc)

function CheckDITATopicref(doc) {
    var DITATopicref = doc.FirstDITATopicrefElementInDoc;    while(DITATopicref.ObjectValid()) {        var myFile = new File(DITATopicref.TopicRefAbsoluteFilePath);        if (!(myFile.exists)) {             $.writeln("The following file is missing: "+ DITATopicref.TopicRefAbsoluteFilePath)        } else {            if(DITATopicref.TopicRefAbsoluteFilePath.split(".")[DITATopicref.TopicRefAbsoluteFilePath.split(".").length-1] == "ditamap"){ //if file is ditamap                var Topicref = Open(DITATopicref.TopicRefAbsoluteFilePath, GetOpenDefaultParams (), new PropVals());                CheckDITATopicref (Topicref)                Topicref.Close(Constants.FF_CLOSE_MODIFIED);            }        }        DITATopicref = DITATopicref.NextDITATopicrefElementInDoc;    }
}

 

I'm wondering if there are faster methods.

  1. Is opening the ditamap mandatory to do the verification?
  2. Do I need to loop through the topicrefs to find the missing ones?

 

Regards


Viewing all articles
Browse latest Browse all 888

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>