Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Possible to export text to .wcml format?

Guest
Jun 04, 2012 Jun 04, 2012

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.

TOPICS
Scripting
1.5K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 04, 2012 Jun 04, 2012

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Mentor ,
Jun 04, 2012 Jun 04, 2012

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

Dirk

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 04, 2012 Jun 04, 2012

My search brought this

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jun 04, 2012 Jun 04, 2012

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jun 05, 2012 Jun 05, 2012
LATEST

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.

Thanks.

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

 

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

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

                    myGetFileName(app.documents.item(0).name);

          }

}

//========================= 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"});

          with(myDialog.dialogColumns.add()){

                    with(dialogRows.add()){

                              with(dialogColumns.add()){

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

                              }

                    }

                    with(dialogRows.add()){

                              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;

                    myDialog.destroy();

                    myExportAllText(myDocumentName, myFilePath, myExportFormat, myAddSeparator);

          }

          else{

                    myDialog.destroy();

          }

}

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

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.parentStory;

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

                                        //Export the story as tagged text.

                                        myStory.exportFile(ExportFormat.taggedText, myTempFile);

                                        myExportedStories.push(myStory.id);

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

                                        myNewStory.insertionPoints.item(-1).place(myTempFile);

                                        //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

          switch(myExportFormat){

                    case "Text Only":

                              myFormat = ExportFormat.textType;

                              myExtension = ".txt"

                              break;

                    case "RTF":

                              myFormat = ExportFormat.RTF;

                              myExtension = ".rtf"

                              break;

                    case "Tagged Text":

                              myFormat = ExportFormat.taggedText;

                              myExtension = ".txt"

                              break;

          }

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

          myNewDocument.close(SaveOptions.no);

          myTempFile.remove();

}

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

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;

          }

          else{

                    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) {

                              return true;

                    }

          }

          return false;

}

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines