0 Replies Latest reply on Jan 28, 2010 5:50 AM by dhishok

    To group images with created text frame and apply label for it...

    dhishok Level 1

      Hi Everyone,



      We are currently working in auto figure placements for CS3. I have placing the figures into the document. Then i am creating figure caption text frames below the images. Here the concern is i need to group these image and the text box. After this i have to place these images with captions into corresponding pages where the figures have been cited. Also suggest me how to place these images in center of the page as well as in top or bottom of the page margin.


      Can anyone help me for this. Your help will be much appreciated.


      Below is my modified script,



      var myPage;
      function main(){
          var myFilteredFiles;
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
          myExtensions = [".jpg", ".jpeg", ".eps", ".ps", ".pdf", ".tif", ".tiff", ".gif", ".psd", ".ai"]
          var myFolder = Folder.selectDialog("Select the folder containing the images", "");
          if(myFolder != null){
                  if(File.fs == "Macintosh"){
                      myFilteredFiles = myMacOSFileFilter(myFolder);
                      myFilteredFiles = myWinOSFileFilter(myFolder);
                  if(myFilteredFiles.length != 0){
                      for (j=0; j<myFilteredFiles.length; j++){
                          var myImages = myFilteredFiles[j];


      function myMacOSFileFilter(myFolder){
          var myFilteredFiles = myFolder.getFiles(myFileFilter);
          return myFilteredFiles;


      function myFileFilter(myFile){
          var myFileType = myFile.type;
          switch (myFileType){
              case "JPEG":
              case "EPSF":
              case "PICT":
              case "TIFF":
              case "8BPS":
              case "GIFf":
              case "PDF ":
                  return true;
              for(var myCounter = 0; myCounter<myExtensions.length; myCounter++){
                  var myExtension = myExtensions[myCounter];    
                      return true;
          return false;   


      //To find cited pages
      function citePage(myInst){
          app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.NOTHING;
          app.findGrepPreferences.findWhat="(?<=Figure \\d\\.)\\d";
          var myFind=app.findGrep(false);
          myPage = myFind[myInst].characters.item(0).parentTextFrames[0].parent;
          return myPage.name;





      Thanks Regards