8 Replies Latest reply on May 2, 2013 5:26 AM by Bill joy

    Refreshment problem when place image.

    Bill joy Level 1

      Hi Experts,

      When I insert image using script then there is a refreshment problem.

      In place of second image there place first image.

      while if I debug this it place in correct order. But in Run case script not place image in order.

      There is a refreshment problem After place First image it not refresh  and have first image.

       

      How solve this problem That i place image in proper order in Script Run mode.

       

       

      #target indesign

      var myDocument=app.activeDocument;        //Active document have 10 spread with text frame

      for(int i=0; i<10;i++)

      {

      var ImagePath="D:\Indesign\" + i + ".indd";         // There are 0.indd to 9.indd, 10 image in "D:\Indesign\"

      var myTextFrame=myDocument.spreads.item(i).textFrames.firstItem();

      myTextFrame.place(File(ImagePath)); // ImagePath is path of image

      }

       

       

      Thanks.

        • 1. Re: Refreshment problem when place image.
          csm_phil Level 4

          Dear Bill,

           

          Can you please insert the this line.

           

           

          #target indesign
          var myDocument=app.activeDocument;        //Active document have 10 spread with text frame
          for(int i=0; i<10;i++)
          {
          $.sleep(1000);
           var ImagePath="D:\Indesign\" + i + ".indd";         // There are 0.indd to 9.indd, 10 image in "D:\Indesign\"
          var myTextFrame=myDocument.spreads.item(i).textFrames.firstItem();
          $.sleep(1000);
          myTextFrame.place(File(ImagePath)); // ImagePath is path of image
          }
          

           

          May be this will help to you.

           

          thx,

          csm_phil

          1 person found this helpful
          • 2. Re: Refreshment problem when place image.
            Bill joy Level 1

            Thanks csm_phil for reply

             

            If I use sleep() then  it slow the execution (run) speed.

            Is there is another solution ?

             

             

            Thanks.

            • 3. Re: Refreshment problem when place image.
              csm_phil Level 4

              Dear Bill,

               

              Yes, exactly it will slow execution, But the problem is solved or not?

               

              May be you can use only one place sleep not more place.

               

              thx,

              csm_phil

              • 4. Re: Refreshment problem when place image.
                Bill joy Level 1

                Thanks csm_phil for reply

                 

                I use sleep but after use sleep there is problem in some image.

                Repete some image in place of another.

                while in debug mode they place ok.

                I also try using apple script and use delay but not sucess.

                There is problem in some image.

                I am not understant why these not place properly.

                 

                Thanks.

                • 5. Re: Refreshment problem when place image.
                  csm_phil Level 4

                  Hi Bill,

                   

                  Can you please try some sample images with your execution js code. If its work fine, May you find out the any one of the images have some problem, so that you can find the images just open the photoshop or illustrator and save as once again and try again.  This is my suggestion.

                   

                  thx,

                  csm_phil

                  • 6. Re: Refreshment problem when place image.
                    Bill joy Level 1

                    Hi csm_phil

                    I think there is no image problem

                    Because If once an image is place sucessfully then next time it replace with above image.

                    This is not fix for any image.

                     

                    Thanks.

                    • 7. Re: Refreshment problem when place image.
                      Bill joy Level 1

                      My problem is like this :

                      I want place image in a text box

                      File(menu)-->place....-->(Dialog open then Select Image file then click on open)->then image is attach  with cursor. (I do not click on .indd open screen).

                      Now I run the script from ExtendedTool Kit

                       

                      #target indesign

                      var myDocument=app.activeDocument;

                      var myTextFrame=myDocument.spreads.item(0).textFrames.firstItem();

                      $.sleep(2000);

                      myTextFrame.place(File("/C/DOCUME~1/ADMINI~1/LOCALS~1/Temp/temp.jpg"));

                      $.sleep(2000);

                      var graphic=myTextFrame.allGraphics[0];

                      graphic.select(SelectionOptions.REPLACE_WITH);

                      graphic.geometricBounds =["-47.853527","-157.370275","1231.018230","709.576702"];

                       

                      When this script run then it place the image which I am select from File(menu)-->place....-->(Dialog open then Select Image file then click on open).

                       

                      Not from the path "/C/DOCUME~1/ADMINI~1/LOCALS~1/Temp/temp.jpg"

                       

                      This is the problem to place image.  So there is image duplicasy and some image missing.

                       

                      Is there is solution of this problem ?

                      How remove image which is already attach with cursor ?

                       

                      Thanks.

                      • 8. Re: Refreshment problem when place image.
                        Bill joy Level 1

                        Hi csm_phil

                         

                        I try :

                         

                        #target indesign

                        var myDocument=app.activeDocument;

                        var myPlaceGun =myDocument.placeGuns();

                        myPlaceGun.abortPlaceGun();

                        var myTextFrame=myDocument.spreads.item(0).textFrames.firstItem();

                        myTextFrame.place(File("/C/DOCUME~1/ADMINI~1/LOCALS~1/Temp/InDtemp/temp.jpg"));

                         

                        but it place some time the above image which is place before this "C/DOCUME~1/ADMINI~1/LOCALS~1/Temp/InDtemp/temp.jpg" image

                         

                        How solve this problem ?

                         

                        Thanks