4 Replies Latest reply on May 22, 2013 7:49 PM by hurix@123

    Place library asset

    hurix@123 Level 1

      Hi,

       

      I am trying to develop a script to all list of Box elements in each library asset and it has been place each asset onto a page where myFind.text is cited.

       

      This is my Script

       

      var myDoc = app.activeDocument;

      app.findTextPreferences = NothingEnum.nothing;

      app.changeTextPreferences = NothingEnum.nothing;

      app.findChangeTextOptions.caseSensitive = false;

      app.findChangeTextOptions.includeFootnotes = false;

      app.findChangeTextOptions.includeHiddenLayers = false;

      app.findChangeTextOptions.includeLockedLayersForFind = false;

      app.findChangeTextOptions.includeLockedStoriesForFind = false;

      app.findChangeTextOptions.includeMasterPages = false;

      app.findChangeTextOptions.wholeWord = false;

      app.findTextPreferences.appliedParagraphStyle = "Box text";

      myFind = myDoc.findText();

      for(i=0; i<myFind.length; i++)

      {

          myLib = app.libraries.item(0);

          myAnchorFrame = myLib.assets.item("Box").placeAsset(myFind[i].insertionPoints[0])[0];

          myFind[i].move(LocationOptions.after, myAnchorFrame.textFrames[0].insertionPoints[0]);

          myAnchorFrame.textFrames[0].parentStory.characters.item(-1).remove();

          myAnchorFrame.appliedObjectStyle = myDoc.objectStyles.item("Box");

          myAnchorFrame.fit(FitOptions.FRAME_TO_CONTENT);

         

          }

       

       

      Hurix

        • 1. Re: Place library asset
          SuriyaRevathi Rengan

          using apple script -> u converted into java script

           

          set LibraryPath to "MAC:Users:user:Desktop:Beecher:Libraries: ProjFolName" & ".indl"

          open LibraryPath

                                  tell application "Adobe InDesign CS5"

                                      

                                          set myasset to place asset asset "glbAssetName" of library nam on active document

           

          end tell

          • 2. Re: Place library asset
            hurix@123 Level 1

            Hi Suriya,

             

            I have placed Library Item which is my activeDocument. See my above javascript code.

             

            my questio is i have to move the item where the "box" is cited in page layout. place either top or bottom.

             

            Hurix

            • 3. Re: Place library asset
              BEGINNER_X Level 3

              Hi hurix123,

               

              Please try the below code, may it will be helpful...

               

              Kindly ensure the paragraph style, object style and library assets....

               

               

               

               

              var myDoc = app.activeDocument

              var myLib = app.libraries[0]

              app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing

              app.findTextPreferences.appliedParagraphStyle = "Box text"

               

              var myFound = myDoc.findText()

               

              for(k=0; k<myFound.length; k++)

              {

                  var myText = myFound[k].texts[0]

                  var myLibraryAsset = app.libraries[0].assets.item("box").placeAsset(myFound[k].insertionPoints[-1])[0]

                  var myTextMove = myFound[k].texts[0].move(LocationOptions.AT_END, myLibraryAsset.insertionPoints[-1])

                  myLibraryAsset.appliedObjectStyle = myDoc.objectStyles.item("Box")

                  myLibraryAsset.fit(FitOptions.frameToContent)

               

                  }

               

               

              Thanks

              Beginner_X

              • 4. Re: Place library asset
                hurix@123 Level 1

                Hi Beginner_X

                 

                Thanks for your support,

                 

                  

                var myTextMove = myFound[k].texts[0].move(LocationOptions.AT_END, myLibraryAsset.insertionPoints[-1])

                 

                Object Dose not support "InsertionPoints".

                 

                I changed Like

                    var myTextMove = myFound[k].texts[0].move(LocationOptions.AT_END, myLibraryAsset.textFrames[0].insertionPoints[-1])

                I works.

                 

                my layout is two columns job, when i place the library item it will place two column width,

                 

                but when the box text is single para it will adjustment in one column widh.

                 

                kindly suggest me.

                 

                Hurix