6 Replies Latest reply on Jun 3, 2014 3:30 AM by kanaga kumar

    KeyTerm pickup

    kanaga kumar

      Dear Friends,

       

      I need keyterm definition placed in stub column

       

      My requirement is:

      1. Multiple keyterms placed in one box

      2. Each keytem placed in each box

       

      Input file:

      Screen Shot 2014-05-22 at 4.36.41 PM.png

      My Requirements:

       

      1. Multiple Keyterm definition placed in one box


      Screen Shot 2014-05-22 at 4.34.03 PM.png



      Screen Shot 2014-05-22 at 4.51.17 PM.png


      This is urget requiremnt kindly help me.


      Thanks

      kanaga kumar. k

       


       











        • 1. Re: KeyTerm pickup
          kanaga kumar Level 1

          Dear Friends,

           

          I tried the below mentioned script but it is quit for Indesign. Kindly help in this regard.

           

          Kindly see my requirement for above:

           

          -----------

          var myDoc = app.documents[0]; 

           

          var myLib = app.libraries[0]; 

           

          app.findTextPreferences = NothingEnum.nothing; 

          app.changeTextPreferences = NothingEnum.nothing; 

           

          app.findTextPreferences = null; 

           

          app.findTextPreferences.appliedParagraphStyles= "KTHD" "KTDEF"; 

           

          myFind = myDoc.findText(true); 

           

          var myCount=0; 

           

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

              {   

                  var myPara = myFind[i].texts[0];   

                  myText = myLib.assets.item ("ANNO").placeAsset (myFind[i].insertionPoints[-1])[0];   

                  myPara.move(LocationOptions.AT_END, myText.insertionPoints[-1]);   

                  myText.appliedObjectStyle = myDoc.objectStyles.item ("Object Styles");   

                  myText.fit(FitOptions.frameToContent);   

                  myCount++;   

              }   

           

           

          alert(myCount+" ANNOs are Placed Successfully..."); 

          ----------------

           

          Thanks

          kanaga kumar.k

          • 2. Re: KeyTerm pickup
            hasvi Level 1

            HI,

             

            try this one, its may help to you

             

            app.findTextPreferences = null; 

            app.findTextPreferences.appliedParagraphStyle = "KTHD"; 

             

            var 

              mFound = app.activeDocument.findText(), 

              len = mFound.length, 

              currWidth, tarText, tarIP, currFrame, currGB, 

              old_VOrigin = app.activeDocument.viewPreferences.verticalMeasurementUnits, 

              old_HOrigin = app.activeDocument.viewPreferences.horizontalMeasurementUnits; 

             

            app.activeDocument.viewPreferences.horizontalMeasurementUnits = app.activeDocument.viewPreferences.verticalMeasurementUnits = MeasurementUnits.POINTS; 

             

            while (len-->0) { 

              tarText = mFound[len]; 

              currWidth = tarText.lines[0].endHorizontalOffset - tarText.lines[0].horizontalOffset + 10; 

              tarIP = tarText.insertionPoints[-1]; 

              currFrame = tarIP.textFrames.add(); 

              setFrame (currFrame); 

              currGB = currFrame.geometricBounds; 

              currGB = [currGB[0], currGB[3] - currWidth, currGB[2], currGB[3]]; 

              currFrame.geometricBounds = currGB; 

              tarText.texts[0].move(LocationOptions.AFTER,currFrame.texts[0]); 

              currFrame.parentStory.characters[-1].remove(); 

              currFrame.fit(FitOptions.FRAME_TO_CONTENT); 

              } 

            app.activeDocument.viewPreferences.horizontalMeasurementUnits = old_HOrigin; 

            app.activeDocument.viewPreferences.verticalMeasurementUnits = old_VOrigin; 

            app.findTextPreferences = null; 

             

            function setFrame (mAnchored){ 

              with (mAnchored) { 

              anchoredObjectSettings.anchoredPosition = AnchorPosition.ANCHORED; 

              anchoredObjectSettings.anchorPoint = AnchorPoint.BOTTOM_RIGHT_ANCHOR; 

              anchoredObjectSettings.horizontalReferencePoint = AnchoredRelativeTo.TEXT_FRAME; 

              anchoredObjectSettings.verticalReferencePoint = VerticallyRelativeTo.LINE_BASELINE; 

             

              textFramePreferences.insetSpacing = [0,0,0,1]; 

              textFramePreferences.verticalJustification = VerticalJustification.BOTTOM_ALIGN; 

              } 

              }

            • 3. Re: KeyTerm pickup
              Jump_Over Level 5

              @ hasvi

               

              Are you sure it is your code?

              Are you sure it is something new for OP, since it is copied from here:

                   Anchor required

               

              By the way, threads like this are getting far away from helping. Only goal is "do something instead of me, plssss"

               

              Jarek

              • 4. Re: KeyTerm pickup
                kanaga kumar Level 1

                Dear Friends,

                 

                I have tried to multiple paragraph styles one syntax (bold highlight) but it is quit in indesign. Any one can advice how to give multiple styles (KTHD and KTDEF) in single entry or any other possibility.

                 

                Please correct the below mentioned bold highlight syntax:

                 

                 

                -----------

                var myDoc = app.documents[0];

                 

                var myLib = app.libraries[0];

                 

                app.findTextPreferences = NothingEnum.nothing;

                app.changeTextPreferences = NothingEnum.nothing;

                 

                app.findTextPreferences = null;

                 

                app.findTextPreferences.appliedParagraphStyle= "KTHD" "KTDEF";

                 

                myFind = myDoc.findText(true);

                 

                var myCount=0;

                 

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

                    {  

                        var myPara = myFind[i].texts[0];  

                        myText = myLib.assets.item ("ANNO").placeAsset (myFind[i].insertionPoints[-1])[0];  

                        myPara.move(LocationOptions.AT_END, myText.insertionPoints[-1]);  

                        myText.appliedObjectStyle = myDoc.objectStyles.item ("Object Styles");  

                        myText.fit(FitOptions.frameToContent);  

                        myCount++;  

                    }  

                 

                 

                alert(myCount+" ANNOs are Placed Successfully...");

                ----------------

                 

                Thanks

                kanaga kumar.k

                • 5. Re: KeyTerm pickup
                  Chinnadk Level 4

                  Hi Kanaga Kumar,

                   

                  Try this.

                   

                  var doc = app.activeDocument;

                  var myLib = app.libraries[0];

                  var Texts = doc.stories.everyItem().textStyleRanges.everyItem().getElements();

                   

                  for(var i =0;i<Texts.length;i++)

                  {

                          if(Texts[i].appliedParagraphStyle == doc.paragraphStyles.item("KTHD"))

                          {

                                  if(Texts[i +1].appliedParagraphStyle == doc.paragraphStyles.item("KTDEF"))

                                  {

                                          var myLibraryItem = app.libraries[0].assets.item("ANNO").placeAsset(Texts[i].insertionPoints[-1])[0];

                                          myLibraryItem.insertionPoints.item(-1).contents  = Texts[i].contents + Texts[i+1].contents;

                                          Texts[i+1].characters.itemByRange(1,-1).remove();

                                          Texts[i].characters.itemByRange(0,-1).remove();

                                          myLibraryItem.insertionPoints.item(0).appliedParagraphStyle = doc.paragraphStyles.item("KTHD");

                                      }

                              }

                      }

                   

                  Regards,

                  Chinna

                  • 6. Re: KeyTerm pickup
                    kanaga kumar Level 1

                    Dear Friend,

                     

                    Thanks for the script, but i have faced some problem. The keyterm ("KTHD") head is not pickup the script. And anchor insertion point is placed in corresponding KT style (megenta rounded box) appear para. Please see below the screen shot.

                     

                    How to fix in automatically adjust height in box and do not need extra entermark (see the screen shot below).

                     

                    Screen shot 2014-06-03 at 3.45.08 PM.png

                     

                    Thanks

                    kanaga kumar. k