6 Replies Latest reply on Jun 9, 2016 1:53 AM by JCmayer

    import formats and edd in subfolders


      Hello everyone.

      I'm newbie in ExtendScript FrameMaker, and it seems a great tool!

      My problem is that I have a folder in which I have full subfolders.

      In this subfolders, I have structured ".fm" files in which, I would like to import a format and edd ...

      I can't.

      Someone could help me for the beginnig?

      Thank a lot

        • 1. Re: import formats and edd in subfolders
          Russ Ward Level 4



          You need to open each document individually, import the EDD, then save and close it. The task of opening and saving a document is the most difficult... to import an EDD is a single call with SimpleImportElementDefs().


          I don't have the time to write this script for you, but I can direct you to this page which has a sample on how to open a document:


          FrameMaker ExtendScript Samples - West Street Consulting


          You would need to adapt it to use all applicable paths to your files. That's the best I can do for you at the moment, I hope it helps some. This does sound like an excellent use case for ExtendScript.



          • 2. Re: import formats and edd in subfolders
            JCmayer Level 1

            Thank a lot Russ,



            I don't use book, and I have a list of my files like that

            var fileList = FolderToTreat.getFiles("*.fm");


            and after i would like treat each file like this

            var i = 0;

            for (i = 0; i < fileList.length; i++)


            file = fileList[i];


            if (file instanceof Folder)


            GetFiles(file, mask);




            my problem that I don't know how to select each file for open them....

            • 3. Re: import formats and edd in subfolders
              Russ Ward Level 4

              You need to learn how to open files. Assuming that your fileList variable has a valid list of paths (which I am not clear on whether it does, because I can't fully understand your code), you would open them one at a time. See the sample on that page I pointed you to for an example on how to open a single file.


              It seems that you may need to back up a bit and study ExtendScript a bit more.



              • 4. Re: import formats and edd in subfolders
                JCmayer Level 1


                Everyone doesn't speak English ... and sometimes it is difficult to understand it!

                I thought the forums were to help newbies, but I am wrong!


                • 5. Re: import formats and edd in subfolders
                  4everJang Level 3



                  A foreign language can be difficult, but that does not mean we are not willing to helping newbies. You cannot expect experienced programmers to explain all of ExtendScript in just a couple of posts. It took me 5 years of full-time trial and error - and posting questions - to get to where I am today.


                  Trial and error are the best ways to learn ExtendScript. Use the Scripting Guide supplied by Adobe on their website: Adobe FrameMaker Scripting Guide (2015 release)


                  Start with simple programs. Take small steps. First open a single file in FM via a script. Then import an EDD. Then import formats. Takes each step when the previous step works and you understand the code you have written.


                  Do not expect to have your full program running in just a couple of hours.


                  Good luck on learning ExtendScript



                  • 6. Re: import formats and edd in subfolders
                    JCmayer Level 1

                    Thank you Jang