Batch create .article files? | Community
Skip to main content
jeffreyp6484616
Level 2
August 25, 2015

Batch create .article files?

  • August 25, 2015
  • 2 replies
  • 9247 views

Since you can't batch update the files in a folio any longer from within InDesign, is it possible to batch create .article files, preferably from the book palate? (Export as PDF doesn't give the option, at least in CC 2014.)

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

2 replies

Adobe Employee
August 25, 2015

Hi,

You could do this via InDesign scripting.

This sample script will ask you to select a folder and will then generate .article files for all the Indd files in that folder.

You may need to modify this script for your environment and setup.

var srcFolder = Folder.selectDialog("Please select path to the InDesign files"); // get source folder

srcFolderContents = srcFolder.getFiles("*.indd"); // get a list indd file

for (var i = 0, n = srcFolderContents.length; i != n; i=i+1) // for each indd file create an article

{

   var articleName = srcFolder + "/" + srcFolderContents[i].name.replace(".indd",".article");

   var doc = app.open(srcFolderContents[i], false);

   var dpsArticleP= [

    [ "assetformat", "pdf"],           // pdf, png, jpg or auto (auto chooses between png and jpg)

    [ "showprogressbar", false ]     

       ];

    app.exportDpsArticle (File(articleName), doc, dpsArticleP); // export article

    doc.close;

}

Level 4
August 25, 2015

Is this script able to work with inDesign files in sub-folders as generated by the script available here:

Rapidly create folios using a PDF-to-InDesign script | Adobe Developer Connection

Adobe Employee
August 28, 2015

Ivan's response wasn't actual code, it was just pseudocode for what one might do. Here's an updated script that also exports the InDesign documents to PNG for use as thumbnail images. I also fixed a bug in my previous post that had the exported articles being put at the top level, instead of in each subfolder.

Note that this will export every page in the InDesign document as a PNG. I can't see anywhere in the InDesign automation APIs to make it only export the first page.

Neil

var srcFolder = Folder.selectDialog("Please select path to the InDesign files"); // get source folder

srcSubfolders = srcFolder.getFiles(onlyFolders);

for (var i = 0, n = srcSubfolders.length; i != n; i=i+1)
{
    srcFolderContents = srcSubfolders[i].getFiles("*.indd"); // get a list indd file
    for (var j = 0, m = srcFolderContents.length; j != m; j=j+1) // for each indd file create an article
    {
       var articleName = srcFolder.name + "/" + srcSubfolders[i].name + "/" + srcFolderContents[j].name.replace(".indd",".article");

      var doc = app.open(srcFolderContents[j], false);
       var dpsArticleP= [
        [ "assetformat", "pdf"],           // pdf, png, jpg or auto (auto chooses between png and jpg)
        [ "showprogressbar", false ]     
           ];

        app.exportDpsArticle (File(articleName), doc, dpsArticleP); // export article
        doc.exportFile(ExportFormat.PNG_FORMAT, File(articleName.replace(".article",".png"))); // export thumbnail image
        doc.close();
    }
}

function onlyFolders(f) {
  if (f.constructor.name == "File") {
    return false;
  } else {
    return true;
  }


To export just the first page, you need to set the export range in pngExportPreferences.

So for example:

app.pngExportPreferences.pngExportRange = PNGExportRangeEnum.EXPORT_RANGE;

app.pngExportPreferences.pageString = "1";

doc.exportFile(ExportFormat.PNG_FORMAT, File(articleName.replace(".article",".png")));

This is turning into some sort of Javascript code camp!

Adobe Employee
October 20, 2015

Hi,

The documentation for the InDesign API (Extendscript) for exporting articles (and uploading them into DPS) can be found here:

* https://helpx.adobe.com/digital-publishing-solution/help/integrating-dps.html

-Klaasjan