6 Replies Latest reply on Nov 23, 2008 1:32 PM by (Ir)

    windows freeze

      Hello,

      I wrote a simple VBA script which I run from MS Excel and which creates a new InDesign (CS3) document and fills it up with data it reads from the Excel sheets. It's a (religious) calendar, so it's not a vast amount of data, just a line of text for each day in the year.

      When I run this script my Windows XP freezes - the Excel window cannot be redrawn until the script finishes etc.

      The hardware the apps run on is pretty powerful - Dell Precision 490 with 4GB RAM, thus I cannot understand why such a script takes few minutes to complete and blocks the whole OS. The task manager says InDesign uses ~90% processor time.

      I am not fresh to programming, but am to InDesign scripting (through VBA). From my few-years-long software development experience I say this script executes far, far worse than expected, although it is extremely simple.

      Is this considered to be normal in ID scripting terms?
        • 1. Re: windows freeze
          Level 1
          Hi Ir,

          It really depends on what the script is doing and how it's written, but what you're doing doesn't sound like it should be taking that long or consuming that many resources. Do other InDesign scripts run from Excel seem extremely slow? Want to post some of your script?

          Thanks,

          Ole
          • 2. Re: windows freeze
            Level 1
            Hi Olav,

            I don't have other scripts to run from Excel - apart from, maybe, some examples from Adobe - which don't do much, just show how things can be done. Is there an available script which I can use as a benchmark?

            I can post the main part of the script, but that would mean more than 300 lines of code. If that is not too much as a post in this forum, and if you or someone is willing to taka a look at it - then I'll post it.

            I am also curious how this script (as a whole) would perform on a different PC.

            To be more precise, I used a stop watch and measured that the script runs for 1 min. and 25 secs.

            I see that I also exaggerated the CPU usage - it was 48-52 % (by InDesign).

            Thanks.
            • 3. Re: windows freeze
              Level 1
              Hi Ir,

              I'd be happy to take a look at it--you can send it to me directly (my email address is under my user name), but you'll need to contact me first so that we can arrange to get it past my email server. No need to post 300 lines here!

              If the script starts out running well and then slows down over time, it might be that you're just running into the problem of InDesign's undo queue. For every action, InDesign writes to disk--that's how we get unlimited undo. If you're only using the user interface, this process isn't particularly painful; if you're executing thousands of events via script, it can be excruciating.

              Rorohiko/Lighning Brain makes a plug-in that can turn off undo, and CS4 incorporates this feature (I think I can say that) via the DoScript method.

              Let's take a look at your script, though, and we'll see what's going on.

              Thanks,

              Ole
              • 4. Re: windows freeze
                Level 1
                I ran the script on several other computers (as mine had some hardware issues, and I suspected that the poor performance was hardware-related), but the results are identical (i.e. worse on less powerfull machines).

                I'd say a script would have to be extremely badly written for such results, but I think that is not the case here. It seems that the Excel-InDesign collaboration is poor, maybe that is not the desired/recommended way to use ID scripting...?

                Olav, I sent you an email a while ago, but got no response.
                • 5. Re: windows freeze
                  Level 1
                  Hi Ir,

                  Could you try again? I don't see any messages from you.

                  Thanks,

                  Ole
                  • 6. Re: windows freeze
                    Level 1
                    Hi Olav,

                    I sent you a second message with the excel file attached. The message subject is the same as this forum topic - widows freeze.

                    Thanks,
                    Ir