2 Replies Latest reply on Jul 6, 2010 4:25 PM by Maria964

    Scale inline vector graphics. Can someone help me...

    Maria964 Level 1



      I confess that I am not a coder. I already tried to learn java scripting but I think this is not in my «nature».


      So can anyone help with this one? I have a book with hundreds of inline vector graphics (wmf's and eps's). When there is a change in the graphic dimensions and I relink the files to update the Indesign CS5 content, the result inside the container is not updated to the real dimensions of the graphic. I have to select the graphic, resize it to 100% and after that I have to apply "Fit Frame to Content". I think this is very easy to achieve with a script. Can someone help me?


      Thanks in advance,




      Although I don't know scripting and can announce that I am studying GREP and I am using it everyday with great benefits....

        • 1. Re: Scale inline vector graphics. Can someone help me...
          [Jongware] Most Valuable Participant

          It is easy to script, but only for those that know how to do it ... InDesign would surely benefit from easy-to-record Actions, like Illustrator and Photoshop ... No reason to worry, though. Just ask in the friendly Scripting Forum


          By the way, a good way to try out complicated GREP finds is to build it up using a GREP style, with a character style that applies Hot Pink underlined Comic Sans Bold to the 'found' text. Switch on the Preview button, write your GREP, check if it highlights everything you want to, then copy the definition and delete the GREP style. Paste definition into the Search field and go.


          This Javascript comes in two parts: the first halve checks if you have a graphic selected with the black arrow (a normal selection). If so, that single graphic is resized and fitted. If not, it scans the entire document for all graphics and applies the commands to all graphics. If you think that's a bit too much, don't include the 2nd halve of the script, everything after the "optionally!" line.


          Copy what you need, paste into Adobe's ESTK Editor, and save into your Script folder as "resizeGraphic.jsx". Select one image and double-click the script, or alternatively, don't select a single graphic and run it to resize/refit everything. (But only if you dare.)


          If you need this a lot, don't forget you can add a keyboard shortcut to the script with the Keyboard Shortcut Editor; it'll automatically appear in the "Scripts" section in there.


          //DESCRIPTION:Size to 100% and Fit to Frame for selected image
          if (app.selection.length == 1 && app.selection[0].hasOwnProperty("graphics") && app.selection[0].graphics.length == 1)
               app.selection[0].graphics[0].absoluteHorizontalScale = app.selection[0].graphics[0].absoluteVerticalScale = 100;
               app.selection[0].fit (FitOptions.FRAME_TO_CONTENT);
          // OPTIONALLY!
               g = app.activeDocument.allGraphics;
               for (i=0; i<g.length; i++)
                    g[i].absoluteHorizontalScale = g[i].absoluteVerticalScale = 100;
                    g[i].parent.fit (FitOptions.FRAME_TO_CONTENT);

          • 2. Re: Scale inline vector graphics. Can someone help me...
            Maria964 Level 1

            THANK YOU! Thank you very much, Jongware. The first halve of the code is precisely what I need.


            When you came to Spain (Madrid) let me know. I will be happy to offer you dinner and show you around.


            I think that we, non coders by nature, should start lobbying Adobe to implement Actions in Indesign...


            If I had the time I think that I could learn scripting because I look at your code and I can devise what is going to happen when it runs. Perhaps next year.


            Thank too for your advices and for the time you spent with the code and with your nice message.


            I use this site to test my greps http://gskinner.com/RegExr/. Perhaps this is good for people with my (low) level of expertise...