2 Replies Latest reply on Feb 12, 2010 5:06 PM by [Jongware]

    [CS3/4] activeBook does not point to "active Book"

    [Jongware] Most Valuable Participant

      Is it me misunderstanding something, or is the "activeBook" property broken?

       

      Found out the hard way today that "app.activeBook" does *not* point to the, erm, 'active' book. Or maybe I don't understand what makes it the active one ... Remember, Books come in a palette, and while you can have one in the front and another in the back (which, I *think*, ought to make the visible one the 'active' book), you can also drag one book file out of it and put it elsewhere on your desktop. Now which one is active? Is the answer a simple "The one ID tells you is active, through the Application's 'activeBook' property"? Nope. That doesn't work at all.

       

      In InDesign CS3 (Windows -- in case it makes a difference), app.activeBook always reports the alphabetically first one, of all your opened books. Didn't think of checking on CS4/Windows at work, but my home CS4/Mac does it exactly the opposite way: it always reports the alphabetically last one!

       

      Steps to recreate:

      1. Write a Javascript that simply reports the active book's name:

          alert (app.activeBook.name)

      2. Create a new book file "Book A". It will open a Books panel, and 'Book A' is the only item in there. Running the who-am-i script tells you "Book A.indb".

      3. Now create a second book file "Book B". It will appear in the Books panel and be active -- the visible book. Sure enough, the who-am-i tells you now "Book B.indb".

      4. So it works? No. Select "Book A" in the panel. The script still thinks "Book B" is active.

      5. Drag one of the books out of its palette onto your workspace -- now you cannot see which one *is* active. The script ensures you it's still "Book B", and no amount of clicking, selecting, or otherwise manipulating either palette will make it change its mind.

       

      I think 'activeBook' is a rather bad thought-out function -- after all, if you have two panels, and both have the Add document buttons and a menu, which one can be considered "active"?

      On the other hand, the only time you -- yes you! John Q. User! -- would be sure to be able to tell which one is active, is when they are both in the same palette, one in front and the other in the back. But the script proves that wrong.

       

      Maybe Adobe uses some other definition of the word 'active', for Books only? As far as I can tell, it works as expected for the two other properties activeDocument and activeWindow ...

        • 1. Re: [CS3/4] activeBook does not point to "active Book"
          Steven.. Level 3

          What you are describing ia not a scripting bug, but rather a bug in the InDesign application, that I think I filed a couple of month's back. The issue cropped up in a C++ plug-in where it became obvious that InDesign can't figure out which book is active.

           

          The bug is, that clicking on the little tab-like piece of a book panel doesn't trigger the kSetCurrentActiveBookCmdBoss Command notifying InDesign that the book has changed. In order to trigger command it is necesary to click on the main panel or it's flyout menu.

           

          Since clicking on flyout menu makes front book active this bug rarely shows itself, except of course when writing a script.

           

          File a bug report and maybe they'll fix this among many other book bugs.

          • 2. Re: [CS3/4] activeBook does not point to "active Book"
            [Jongware] Most Valuable Participant
            Since clicking on flyout menu makes front book active this bug rarely shows itself, except of course when writing a script.

             

            That's what I was thinking, yes. Thanks for the technical background story!