5 Replies Latest reply on Jun 5, 2012 1:48 PM by Matthew.Fry

    Possible to export text to .wcml format?

    Matthew.Fry Level 1

      I have found several different scripts for exporting text from an InDesign page into .txt, .rtf and .doc. I am wondering if it is possible to export text to a .wcml format.

        • 1. Re: Possible to export text to .wcml format?
          [Jongware] Most Valuable Participant

          These scripts do nothing else than call on InDesign's built-in export capabilities. Since it has no filter for "wcml", there is nothing existing to call upon.


          Perhaps you could write your own, if it's a basic text based format, but Googling brings up "West Coast Main Line" and "WCML FM", so if it's either a railroad format or some music file, you're out of luck.

          • 2. Re: Possible to export text to .wcml format?
            Dirk Becker Level 4

            If I remember that correctly, wcml is just WoodWing's brew of icml.



            • 3. Re: Possible to export text to .wcml format?
              Larry G. Schneider Adobe Community Professional & MVP

              My search brought this


              Screen shot 2012-06-04 at 3.22.59 PM.png

              • 4. Re: Possible to export text to .wcml format?
                Loic.Aigon Adobe Community Professional

                I am happy to see I wasn't the only one confused with the google results on WCML

                • 5. Re: Possible to export text to .wcml format?
                  Matthew.Fry Level 1

                  We are using WoodWing's Content Station and Smart Connection.


                  We recently lost several months worth of articles from the system. So I am pulling articles off of the InDesign pages using the script listed below (ExportAllText.jsx), which exports all of the text from the page to either a .txt or .rft document. Since our articles in WoodWing are .wcml, I was hoping I could export the text in this format.


                  There are 2 modifications I would like to make on the script:

                  1. I want to name the exported text file the same name of the InDesign page (example: vds-06.04-a1) instead of having to input a name each time.

                  2. I want to do away with the dialog box and set it to export to .txt (or .wcml) and add the separator line.





                  • • • • • • • • • • • • • • • • • •




                  if(app.documents.length != 0){

                            if(app.documents.item(0).stories.length != 0){




                  //========================= FUNCTIONS ===========================

                  function myGetFileName(myDocumentName){

                            var myFilePath = File.saveDialog("Save Exported File As:");

                            if(myFilePath != null){

                                      myDisplayDialog(myDocumentName, myFilePath);



                  //---------------------------------------------------------------------------------------- ----------------------

                  function myDisplayDialog(myDocumentName, myFilePath){

                            //Need to get export format, story separator.

                            var myExportFormats = ["RTF", "Tagged Text", "Text Only"];

                            var myDialog = app.dialogs.add({name:"ExportAllStories"});




                                                          var myExportFormatDropdown = dropdowns.add({stringList:myExportFormats, selectedIndex:0});




                                                var myAddSeparatorCheckbox = checkboxControls.add({staticLabel:"Add separator line", checkedState:true});



                            var myResult = myDialog.show();

                            if(myResult == true){

                                      var myExportFormat = myExportFormats[myExportFormatDropdown.selectedIndex];

                                      var myAddSeparator = myAddSeparatorCheckbox.checkedState;


                                      myExportAllText(myDocumentName, myFilePath, myExportFormat, myAddSeparator);






                  //---------------------------------------------------------------------------------------- ----------------------

                  function myExportAllText(myDocumentName, myFilePath, myExportFormat, myAddSeparator){

                            var myPage, myStory;

                            var myExportedStories = [];

                            var myTempFolder = Folder.temp;

                            var myTempFile = File(myTempFolder + "/tempTextFile.txt");

                            var myNewDocument = app.documents.add();

                            var myDocument = app.documents.item(myDocumentName);

                            var myTextFrame = myNewDocument.pages.item(0).textFrames.add({geometricBounds:myGetBounds(myNewDocument, myNewDocument.pages.item(0))});

                            var myNewStory = myTextFrame.parentStory;

                            for (var i = 0; i < myDocument.pages.length; i++) {

                                      myPage = myDocument.pages.item(i);

                                      for (var t = 0; t < myPage.textFrames.length; t++){

                                                myStory = myPage.textFrames[t].parentStory;

                                                if (!IsInArray(myStory.id, myExportedStories)) {

                                                          //Export the story as tagged text.

                                                          myStory.exportFile(ExportFormat.taggedText, myTempFile);


                                                          //Import (place) the file at the end of the temporary story.


                                                          //If the imported text did not end with a return, enter a return

                                                          //to keep the stories from running together.

                                                          if(i != myDocument.stories.length -1){

                                                                    if(myNewStory.characters.item(-1).contents != "\r"){

                                                                              myNewStory.insertionPoints.item(-1).contents = "\r";


                                                                    if(myAddSeparator == true){

                                                                              myNewStory.insertionPoints.item(-1).contents = "----------------------------------------\r";



                                                } // if not exported

                                      } // for text frames

                            } // for pages


                                      case "Text Only":

                                                myFormat = ExportFormat.textType;

                                                myExtension = ".txt"


                                      case "RTF":

                                                myFormat = ExportFormat.RTF;

                                                myExtension = ".rtf"


                                      case "Tagged Text":

                                                myFormat = ExportFormat.taggedText;

                                                myExtension = ".txt"



                            myNewStory.exportFile(myFormat, File(myFilePath));




                  //---------------------------------------------------------------------------------------- ----------------------

                  function myGetBounds(myDocument, myPage){

                            var myPageWidth = myDocument.documentPreferences.pageWidth;

                            var myPageHeight = myDocument.documentPreferences.pageHeight

                            if(myPage.side == PageSideOptions.leftHand){

                                      var myX2 = myPage.marginPreferences.left;

                                      var myX1 = myPage.marginPreferences.right;



                                      var myX1 = myPage.marginPreferences.left;

                                      var myX2 = myPage.marginPreferences.right;


                            var myY1 = myPage.marginPreferences.top;

                            var myX2 = myPageWidth - myX2;

                            var myY2 = myPageHeight - myPage.marginPreferences.bottom;

                            return [myY1, myX1, myY2, myX2];


                  //---------------------------------------------------------------------------------------- ----------------------

                  function IsInArray(myString, myArray) {

                            for (x in myArray) {

                                      if (myString == myArray[x]) {

                                                return true;



                            return false;


                  //---------------------------------------------------------------------------------------- ----------------------