2 Replies Latest reply on Mar 21, 2013 12:26 PM by E Diane King

    Need to global find and scale and resize frame on a linked graphic

    E Diane King Level 2

      http://forums.adobe.com/message/5167443#5167443

       

      Someone suggested that I cross post this to see if there is an easy scripting solution to my dilemma. See post link above.

        • 1. Re: Need to global find and scale and resize frame on a linked graphic
          -hans- Level 4

          Give it a try

           

           

          #target Indesign
          
          var toSearch = 'example.ai' //to edit: name of the ai to work on
          
          //select a folder with inddFiles
          var selFolder = Folder.selectDialog();
          if(!selFolder) {exit();};
          var allInddFiles = selFolder.getFiles('*.indd');
          
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
          for(var i = 0; i < allInddFiles.length; i++)
          {
              currItem = allInddFiles[i];
          var currDoc = app.open(currItem);
          changeAI(currDoc);
          }
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
          
          function changeAI(docRef)
          {
          var currGraphics = docRef.allGraphics;   
              l = currGraphics.length;
              while(l--){
                  currGraphic = currGraphics[l];
          var currName =   currGraphic.itemLink.name;
          if(currName == toSearch){
          currGraphic.horizontalScale = 30;
          currGraphic.verticalScale = 30;
          currGraphic.parent.fit(FitOptions.FRAME_TO_CONTENT)
              }
                      }
                  currDoc.close(SaveOptions.YES);
                  }
          
          • 2. Re: Need to global find and scale and resize frame on a linked graphic
            E Diane King Level 2

            You, my friend, are a life saver!  Thanks so much, Hans.