8 Replies Latest reply on Oct 15, 2012 5:15 AM by hurix@123

    figure placing in cs2/cs3

    M Karthik

      Hi All,

       

      I have more than 200 images need to place in indesign. Every time i need to place the images manually.

      In my indesign i have a tag like <<figure 36>> then followed be the figure caption. My figure name is F0036.eps.

       

      Kinldy help me how to place the figures using script.....

       

      Thanks

      Karthik

        • 1. Re: figure placing in cs2/cs3
          csm_phil Level 4

          Hi Karthik,

           

          I have one doubt above mentioned your request, you working in xml work flow or word file flow.

           

          thx

          csm_phil

          • 2. Re: figure placing in cs2/cs3
            M Karthik Level 1

            i am working on word file flow.....

            • 3. Re: figure placing in cs2/cs3
              csm_phil Level 4

              Hi Karthik M,

               

              Please try the below JS Code, the script will find and change the format after import the figure into the inline figure if you want anchor please apply the anchored object styles. And one morething the script only consider the input format only and eps files only. if you want ai or tifff you can modify the script.

               

              I hope this is you expect.

               

              var myFolder=Folder.selectDialog("Choose a Art folder!");
              
              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
              app.findGrepPreferences.findWhat="(?i)<<figure (\\d+)>>";
              app.changeGrepPreferences.changeTo="F00$1.eps";
              app.documents.item(0).changeGrep();
              
              
              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
              app.findGrepPreferences.findWhat="(?i)F00\\d+.eps";
              mySearch = app.findGrep(true);
              for(a=0;a<mySearch.length;a++){
                   try{
                        mySearch[a].characters[0].insertionPoints[0].place(File(myFolder + "/" + mySearch[a].contents));
                        }catch(e)     {}
                   }
              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
              app.findGrepPreferences.findWhat="(?i)F00\\d+.eps";
              app.changeGrepPreferences.changeTo="";
              app.documents.item(0).changeGrep();
              app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
              

               

              thx

              csm_phil

              • 4. Re: figure placing in cs2/cs3
                M Karthik Level 1

                Yes! Its a great job.......... Thanks csm_phil.

                Is there any way to place the figure top of the page along with the caption?

                the script is placing the figures iniside of text frame. like the below image

                current.JPG

                I'm trying to place the figure top the text frame. like the below image

                need.JPG

                Is it possible to place the figure top of the frame along with the caption using the JS script? Please help me.....

                 

                Thanks

                Karthik

                • 5. Re: figure placing in cs2/cs3
                  csm_phil Level 4

                  Hi Karthik,

                   

                  Post your caption text frame creation after i will modify and post into the forum.

                   

                  thx

                  csm_phil

                  • 6. Re: figure placing in cs2/cs3
                    M Karthik Level 1

                    Hi csm_phil,

                     

                    Thanks for yours reply........

                     

                    var myDoc = app.activeDocument;
                    app.findTextPreferences = null;
                    app.changeTextPreferences = null;

                    app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("Fig_cap");

                    figcaption = myDoc.findText();
                    var captionText = figcaption[0].contents;

                    app.select(figcaption[0]);
                    app.cut(app.selection[0]);

                     

                    The above script is find my figure caption. Now i could not able to place the caption on a new frame.

                    • 7. Re: figure placing in cs2/cs3
                      M Karthik Level 1

                      Hi csm_phil,

                       

                      the below placed script find my figure cpation and place to an external frame.

                       

                      var myDoc = app.activeDocument;
                      
                      app.findTextPreferences = null;
                      app.changeTextPreferences = null;
                      
                      app.findTextPreferences.appliedParagraphStyle = app.activeDocument.paragraphStyles.item("Figure");
                      
                              var captionText = figcaption[0].contents;
                              app.select(figcaption[0]);
                              app.cut(app.selection[0]);
                              
                              curpage = myDoc.pages.item(app.activeWindow.activePage.name);
                              allframes = curpage.textFrames;
                              app.select(allframes[0])
                              capframe = curpage.textFrames.add();
                              capframe.contents = "<<fig_cap>>";
                              app.findTextPreferences = null;
                              app.changeTextPreferences = null;
                              app.findTextPreferences.findWhat= "<<fig_cap>>";
                              temp = myDoc.findText();
                              app.select(temp);
                              app.paste();
                              capframe.fit(FitOptions.frameToContent);
                              capframe.textFramePreferences.insetSpacing = ["12", "0", "0", "0"];
                              capframe.fit(FitOptions.frameToContent);
                      

                       

                      Kindly help me on this...........

                      • 8. Re: figure placing in cs2/cs3
                        hurix@123

                        We have more than 22 images need to place in indesign. Every time i need to place the images manualy.

                         

                        In my Indesign i have a xml tag like <graphics 1> the folowed be the figures caption. my Figure name is Grap01.eps.

                         

                        Kindly help me how to place the figures using script