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


_______________________________________________


You are currently subscribed to framers as arch...@mail-archive.com.

Send list messages to framers@lists.frameusers.com.

To unsubscribe send a blank email to
framers-unsubscr...@lists.frameusers.com
or visit 
http://lists.frameusers.com/mailman/options/framers/archive%40mail-archive.com

Send administrative questions to listad...@frameusers.com. Visit
http://www.frameusers.com/ for more resources and info.

Reply via email to