5 Replies Latest reply on Mar 2, 2014 2:24 AM by Laubender

    Hundreds of images... need a script for pan & zoom

    Davd Spivak - Artstories Level 1

      Has anyone come up with a way to do a mass pan & zoom for all of the images in the document? I have over 300 and it's slightly tedeious to sit here and do a manual pan & zoom on all of them.

        • 1. Re: Hundreds of images... need a script for pan & zoom
          Laubender Adobe Community Professional & MVP

          @FocusGroup – are you talking in terms of Adobe Digital Publishing Suite (ADPS)?

          If so, the pan & zoom feature when set is tied to the container frame of a particular image.

           

          So, if you would start from scratch, you could prepare one pan & zoom conatiner holding one image, duplicate that and change the placed image inside to a new one. The pan & zoom feature will survive…

           

          Are you experienced in ExtendScript scripting?

          If yes, you could retrieve the pan & zoom feature on a sample and apply it to all other images.

          In essence that feature is nothing but a string injected with the method:

          insertLabel("keyString","valueString")

           

          If you know the right key string, you could retrieve the right value string for setting this feature with:

          extractLabel("keyString")

           

          To get the right key, you could export the container object with the pan & zoom feature to IDMS and inspect the file in a text editor.

           

          Or if you have InDesign CS5 or CS5.5 (and only these versions!), you could export an IDML of your container, open that in InDesign CS5, select the container, go to the ESTK app (ExtendScript Toolkit) and write out all injected labels with:

           

          try{
          var keyValuePairsArray = app.selection[0].extractLabel();
          }catch(e){keyValuePairsArray = new Array()};
          
          for(var n=0;n<keyValuePairsArray.length;n++){
              $.writeln(keyValuePairsArray[n].join("\t"));
              };
          

           

          I did that with ADPS v29 installed with InDesign CS5.5 and got the following two key/value pairs for the selected object:

           

          TypeImagePan
          SS_WebViewOverlayContainer=false

           

          If we use the first pair of strings, "Type" for key and "ImagePan" for value, we could apply that to all image containers in the document. The second one is applied automatically when you apply the first one in the UI with overlay creator. Don't know, if it's absolutely necessary to inject this one, too…

           

          So your solution could be:

           

          var myDoc = app.documents[0];
          var myLinks = myDoc.links;
          
          for(var n=0;n<myLinks.length;n++){
              myLinks[n].parent.parent.insertLabel("Type","ImagePan");
              };
          

           

          If all your links are graphics of type image and you really want to pan & zoom every single graphic.

          If you want exclude some linked objects (like placed PDFs, Movies, Sounds or text files) you have to filter them out in the for loop…

           

          Uwe

          • 2. Re: Hundreds of images... need a script for pan & zoom
            Laubender Adobe Community Professional & MVP

            I have to correct myself a bit. The used version of ADPS was v24, an old one, so the key/value pairs could have changed. I'll try this with InDesign CS6 with v29 installed and let you know, if there is a difference…

             

            Uwe

            • 3. Re: Hundreds of images... need a script for pan & zoom
              Laubender Adobe Community Professional & MVP

              Just tested. That method will not work with InDesign CS6 and v29 of DPS. Sorry.

              But if you are using the script in CS5.5 and open the file in CS6 the pan & zoom feature will travel over to CS6.

               

              Then I did the reverse: made an image container with the pan & zoom feature in CS6, exported to IDML and opened that in CS5.5, retrieved the key/value pairs and got:

               

              TypeImagePan
              kAdobeDPSInteractivity_TypeImagePan
              kAdobeDPSInteractivity_WebViewOverlayContainerfalse

               

              So, if we lucky we could do the following in CS6:

               

              var myDoc = app.documents[0];
              var myLinks = myDoc.links;
              
              for(var n=0;n<myLinks.length;n++){
                  myLinks[n].parent.parent.insertLabel("Type","ImagePan");
                  myLinks[n].parent.parent.insertLabel("kAdobeDPSInteractivity_Type","ImagePan");
                  myLinks[n].parent.parent.insertLabel("kAdobeDPSInteractivity_WebViewOverlayContainer","false");
                  };
              

               

              Just tested with InDesign CS6 and a couple of linked images.
              It is working!

               

              Uwe

              • 4. Re: Hundreds of images... need a script for pan & zoom
                Laubender Adobe Community Professional & MVP

                I might add: depending on your version of InDesign and the installed version of your ADPS, these key/value pairs might change. If a new version of ADPS is out, let's say v30 in a couple of weeks and if you are using InDesign CC v9.2.0, it's well possible, that the values changed again.

                 

                And it's also clear, having InDesign CS5 or CS5.5 at hand is a boon :-)

                 

                Uwe

                • 5. Re: Hundreds of images... need a script for pan & zoom
                  Laubender Adobe Community Professional & MVP

                  @FocusGroup – now, a couple of days passed by…
                  Could you make it work with my small ExtendScript script snippet in answer #3 ?

                   

                  Uwe