4 Replies Latest reply on Jul 12, 2013 1:37 AM by Trevil72

    Export library to snippets

    Trevil72

      Hi

       

      I'm new to scripting, but i have managed to patch together this script. (Much thanks to tips from people at this forum (Green4ever: snippetexport and tomaxxi: grouping).

       

      The script exports every item (asset) in a library to individual snippet files. The files get their names from the library items. Does anyone know if its possible to export the snippets whithout grouping it?

       

       

      myLibrary = app.libraries[0];

      myLibraryPanel = myLibrary.associatedPanel;

       

       

      for( i = 0; i < app.libraries[0].assets.length; i++ ){

          var myObj = app.libraries[0].assets[i].placeAsset(app.documents[0])[0];

          var myName = app.libraries[0].assets[i].name

          var myGroup = new Array();

          myGroup = app.activeWindow.activeSpread.pageItems;

             

               if (app.activeWindow.activeSpread.pageItems.length >1){

              app.activeWindow.activeSpread.groups.add(myGroup);

       

              var obj = app.activeWindow.activeSpread.pageItems.everyItem();

              obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));

              obj.remove(0);     

            }

      else { }

          var obj = app.activeWindow.activeSpread.pageItems.everyItem();

          obj.exportFile(ExportFormat.INDESIGN_SNIPPET, File("/path/"+ myName + ".idms"));

          obj.remove(0);

      }