5 Replies Latest reply on Dec 5, 2011 2:22 AM by V.Dnath

    INdesign Cs4 java script

    V.Dnath Level 1

      helo.. Sir

       

      Plz help me once again..

      Actulay i want to change this script into user friendly way, 

      script for search all the charcter style 'KT' with associated page num,

      but now i want to make it as dropdownlist and select the any style and run this script as privious as like given script..

      ---

      var myDoc =app.activeDocument;
      app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
      app.findTextPreferences.appliedCharacterStyle = "KT";
      var mySearch = app.findText(false);
      for(var a=mySearch.length-1; a>=0; a--){
           var  myText= mySearch[a];
           var myPagenum = myText.parentTextFrames[0].parent.name;
           var myContents = myText.contents;
           app.selection[0].insertionPoints[-1].contents = String(myContents+"\t"+myPagenum);
           app.selection[0].insertionPoints[-1].contents = "\r";
           }
      app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

      ---

      plz give me answer as soon as possible...

      thanks

      with warm regards

      vijay singh

        • 1. Re: INdesign Cs4 java script
          csm_phil Level 4

          Hi Vijay,

           

          Please use the below JS code is as per your request.

           

           

          var myDoc =app.activeDocument;
          
          var myLW = 100;
          var myStyleNames = myDoc.characterStyles.everyItem().name;
          var myDialog = app.dialogs.add({name:"Character Style KT Page Numbers Create", canCancel:true});
               with(myDialog.dialogColumns.add()){     
                    with(borderPanels.add()){
                         with(dialogColumns.add()){staticTexts.add({staticLabel:"Choose the KT Character Style:   ", minWidth:myLW});}
                              with(dialogColumns.add()){var myChooseStyle = dropdowns.add({stringList:myStyleNames, selectedIndex:0});}
                              }
                         }
          var myResult = myDialog.show();
          if(myResult == true){
               var mySelStyle = myStyleNames[myChooseStyle.selectedIndex];
               myDialog.destroy();
          }
          else{
               myDialog.destroy();
          }
          
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
          app.findTextPreferences.appliedCharacterStyle = mySelStyle.toString();
          var mySearch = app.findText(false);
          for(var a=mySearch.length-1; a>=0; a--){
               var  myText= mySearch[a];
               var myPagenum = myText.parentTextFrames[0].parent.name;
               var myContents = myText.contents;
               app.selection[0].insertionPoints[-1].contents = String(myContents+"\t"+myPagenum);
               app.selection[0].insertionPoints[-1].contents = "\r";
               }
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
          

           

          thx

          csm_phil

          • 2. Re: INdesign Cs4 java script
            V.Dnath Level 1

            thanks alot sir..

            correct ans

            • 3. Re: INdesign Cs4 java script
              [Jongware] Most Valuable Participant

              vijai singh wrote:

               

              helo.. Sir

               

              Plz help me once again..


              [...] plz give me answer as soon as possible...

               

              If you are going to regularly 'request' scripts, please read this link:

               

              Scripting Forum Conduct

              Loading...

              While this forum is a great place to get scripting help, it's also very easy to misuse it. Before using this forum, please read this post!

               

              And please use a more descriptive title for your demands. All of these posts are about Indesign scripts.

              1 person found this helpful
              • 4. Re: INdesign Cs4 java script
                csm_phil Level 4

                Hi vijay,

                 


                Please before you need any help from scripting forum please post your js code what you have tried, Then only any one help to you easy.
                please read the thread in jongware post.

                 


                Hi Jongware,

                 

                Hereafter i will take care of the script source to given from any one.

                 

                i was read the threaded when i was start the scripting froums. Any way here after i will just give the information only or i will share the methods.

                 

                Sorry jongware please regret.

                 

                thx

                 

                csm_phil

                • 5. Re: INdesign Cs4 java script
                  V.Dnath Level 1

                  ok sir,, i will keep this rule in my mind...

                   

                  thx

                  vijay