3 Replies Latest reply on Jul 10, 2009 3:09 AM by liedzeit

    script information out of a particular layer from Indesign

    bostonapparel

      I am trying to create a simple script which will point to an Indesign CS3 document and extract the information from a particular layer..... I am having a tough time. I know you can script pretty much anything :-)

        • 1. Re: script information out of a particular layer from Indesign
          liedzeit

          You should be just a little bit more concrete.How should the script point to an InDesign document? You mean open a particular document. And what kind of information do you want to extract?

           

          Ralf

          • 2. Re: script information out of a particular layer from Indesign
            bostonapparel Level 1

            I mean open an Indesign document and extract data from a particular layer. For example, I would have a layer called "Spot" and on this layer would be all copy blocks that I will need exported into a text file? If I didn't have to open the document, it would be even better...Does that make sense? Thank you

            • 3. Re: script information out of a particular layer from Indesign
              liedzeit Level 2

              You have to open a document to be able to script it. I would first start with an open document and if this works open documents of a particular folder for example.

              Try something like this:

               

               

              var myFormat = ExportFormat.textType;

              var myExtension = ".txt";

              var myFolder="~/Documents/Spot";

              var mydoc=app.activeDocument;

              var mylayer=mydoc.layers.itemByName("Spot");

              for(i = 0; i < app.activeDocument.stories.length; i++)

              {

              myStory = app.activeDocument.stories.item(i);

              var tc=myStory.textContainers[0];

              if (tc.itemLayer==mylayer)

              {

              myID = myStory.id;

              myFileName = "StoryID" + myID + myExtension;

              myFilePath = myFolder + "/" + myFileName;

              myFile = new File(myFilePath);

              myStory.exportFile(myFormat, myFile);

              }

              }

               

               

              This will save your stories into text files. If this is what you want.

               

              Ralf