10 Replies Latest reply on Mar 24, 2010 2:47 PM by augur165

    [JS][CS4] big script problem




      Has any one come into any problems running big scripts in indesign?


      every time i try to run my script @ 73.5MB it just crashes, if i cut a lot of the pages out so its down to 3-4MB it works.


      i just get the error "Runtime Error!"


      any one got any ideas?





        • 1. Re: [JS][CS4] big script problem
          Fred Goldman Level 3

          What does your script do?

          • 2. Re: [JS][CS4] big script problem
            John Hawkinson Level 5

            74mb seems unreasonably large. What if you cut it into several smaller scripts that are executed by a parent script?

            • 3. Re: [JS][CS4] big script problem
              jonny64bit2 Level 1

              yeah i was thinking of trying that.


              its basically creates a massive catalogue about 400 pages or so, with lots detail.


              we used to do this Pagemaker and it worked fine with this length of script.

              • 4. Re: [JS][CS4] big script problem
                Harbs. Level 6

                I read it that he has the problem when running on a large InDesign file.


                I can't imagine it's a 74 MB script file...



                • 5. Re: [JS][CS4] big script problem
                  jonny64bit2 Level 1

                  the script adds a new document and adds pages when needed to indesign.

                  • 6. Re: [JS][CS4] big script problem
                    Harbs. Level 6

                    Something is very not clear.


                    Are you saying you have a script with millions of lines?


                    As I figure it, a 74 MB script should be between 1 and 2 million lines!!!


                    Please explain clearly what the problem is.



                    • 7. Re: [JS][CS4] big script problem
                      jonny64bit2 Level 1

                      Right ive got a database which connects to a c++ program which makes a extendscript file which in turn creates a catalogue in indesign


                      can output this for a small number of products and it works (say about 2-3MB file), if i let if go an run it on the whole product base the script file is 1555816 lines long. (so 10/10 for the guess at 1-2 million )


                      the script does:


                      creates document

                      sets up all the document settings

                      does master pages

                      create all the paragraph style


                      creates a text frame, and i add text to the story.


                      so it reapeats this alot:


                      myInsertionPoint = myTextFrame.parentStory.insertionPoints.lastItem();

                      myInsertionPoint.contents  = "\t";

                      myParagraphStyle = myDocument.paragraphStyles.item("ABCStyle");


                      myInsertionPoint = myTextFrame.parentStory.insertionPoints.lastItem();

                      myInsertionPoint.contents  = "\t";


                      myInsertionPoint = myTextFrame.parentStory.insertionPoints.lastItem();

                      myInsertionPoint.contents  = "11/82-10/87";


                      the problem is that when i click on the script to run it i just get the error message "Runtime Error!"


                      i hope this makes it more clear and thanks for any help

                      • 8. Re: [JS][CS4] big script problem
                        [Jongware] Most Valuable Participant

                        Step one is to create a function that inserts the text with the right paragraph style. Something like


                        addTextAtEnd ("ABCStyle", "11/82-10/87");


                        That will shrink down the script to, oh, 50 lines -- plus all required data.


                        InDesign can't really handle lots of data in a Javascript, but I don't know what its limit is. You could try throwing all of it into an array, and if that fails, write the data as plain text into another file and have the script open this and process line by line.

                        • 9. Re: [JS][CS4] big script problem
                          Harbs. Level 6



                          I have never heard of a workflow like that.


                          There has to be a million ways of improving this. Jong mentioned one.


                          You can do the whole thing in C++.

                          You can write to IDML instaed of making a script to process the data.



                          InDesign needs to parse a script before running it, and I can easily 

                          imagine that a 74 MB script will cause InDesign to run out of memory...



                          • 10. Re: [JS][CS4] big script problem
                            augur165 Level 1

                            This seems way too over the top when IDML exists and everything that you are doing can be detected, read and effected in the XML. My team and I have developed a system running from a LAMP stack that renders IDML for 900+ page catalogs in seconds. Opening the InDesign pages with assets takes a bit longer.