5 Replies Latest reply: May 27, 2009 6:33 AM by Harbs. RSS

    Go to page in different document when working on a book file.

    Shlomit Heymann Community Member

      Hello,

      I was wondering if there is a shortcut to go to a page that belongs to a document in a book file without having first to bring the document to front.

      I got 11 documents and would like to get fast to pages.

       

      thanks you

      shlomit

        • 1. Re: Go to page in different document when working on a book file.
          Harbs. CommunityMVP

          Hi Shlomit,

           

          Short answer: No.

           

          Long answer: Yes, with a script. Here's a script which does that. The script is a bit fragile. The documents need to be open and the pages must be named with numbers (and not letters or what-have-you...)

           

          //DESCRIPTION: Jumps to a page number in the first open book
          //AUTHOR: Harbs www.in-tools.com
          main();
          function main(){
            try{var book = app.books[0]}
            catch(e){alert("No Book File Open!");return}
            var lastNumber=null;
            var contents = book.bookContents.everyItem().getElements();
            for(var i=contents.length-1;i>=0;i--){
              //alert(contents[i].constructor.name);
              if(contents[i] instanceof Document || contents[i].status==BookContentStatus.DOCUMENT_IS_OPEN ){
                if(contents[i] instanceof BookContent){
                  contents[i].getElements();
                  var fullName = contents[i].fullName;
                  var doc =app.open(File(fullName));
                } else {
                  var doc=contents[i];
                }
                lastNumber = parseFloat(doc.pages[-1].name);i=-1;
              }
            }
            if(!lastNumber){alert("Book Documents not Open!");return}
            var d=app.dialogs.add({name:"Jump To Page Number:"});
            var numberBox = d.dialogColumns.add().integerEditboxes.add({minimumValue:1,maximumValue:lastNumber,editValue:1,smallNudge:1,largeNudge:10});
            var result = d.show();
            if(!result){d.destroy();return}
            var selectedPage = numberBox.editValue;
            d.destroy();
            for(var i=0;i<contents.length;i++){
              if(contents[i] instanceof BookContent && contents[i].status!=BookContentStatus.DOCUMENT_IS_OPEN){continue}
              if(contents[i] instanceof BookContent){
                var doc = app.open(File(contents[i].fullName));
              } else {
               var doc = contents[i];
              }
              var pages = doc.pages.everyItem().getElements();
              for(var j=0;j<pages.length;j++){
                if(pages[j].name==selectedPage){
                  app.activeWindow = doc.layoutWindows[0];
                  app.activeWindow.activePage = pages[j];
                  return;
                }
              }
            }
            alert("Couldn't Find the Page! Is Your Document Open?");
          }
          

          Harbs

          • 2. Re: Go to page in different document when working on a book file.
            Shlomit Heymann Community Member

            thanks herbs.

            how unclever that is, to allow working with book file and not be able to do so...

            s

            • 3. Re: Go to page in different document when working on a book file.
              BobLevine CommunityMVP

              How about adding a cross reference and then using the go to destination button hyperlinks panel to go to it?

               

              Bob

              • 4. Re: Go to page in different document when working on a book file.
                Shlomit Heymann Community Member

                got 200 pictures pages... need to go quick to each page del or add a pic.

                • 5. Re: Go to page in different document when working on a book file.
                  Harbs. CommunityMVP

                  Shlomit,

                   

                  Did the script work for you?