Hi all,

I'm trying to create my first ExtendScript to automate converting a batch of 
FM11 documents to FM10. The goal is to point the script to a folder, and have 
it convert all FM files in this folder.
I've cobbled together the following. I'm getting tripped up by the command to 
open a file (var doc = app.open(bestand);). I copied this from a Photoshop 
script, but it doesn't work in FrameMaker. The Extendscript IDE isn't very 
helpful, and the few FrameMaker examples I've found all work on the active 
document or book.
How do I open a file?


#target "framemaker"

var inputFolder = Folder.selectDialog("Input folder");
var outputFolder = Folder.selectDialog("Output folder");
var name, saveParams, i;

if (inputFolder != null && outputFolder != null) {
    var files = inputFolder.getFiles("*.fm");
    for (var i = 0; i < files.length; i++) {
        var bestand = files[i];

        var doc = app.open(bestand);
        name = doc.Name;
                          saveParams = GetSaveDefaultParams();
                          returnParams = new PropVals();
                          i = GetPropIndex(saveParams, Constants.FS_FileType);
                          saveParams[i].propVal.ival 
=Constants.FV_SaveFmtBinary100;
                          doc.Save(name, saveParams, returnParams);
                          doc.Close(Constants.FF_CLOSE_MODIFIED);

     doc.close(SaveOptions.DONOTSAVECHANGES);
        $.writeln('File ' + (i + 1) + ' of ' + files.length + ' processed');
    }

}

Kind regards,
Harro de Jong


-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
<http://lists.frameusers.com/pipermail/framers/attachments/20131218/f97d348d/attachment.html>

Reply via email to