6 Replies Latest reply on Jun 29, 2014 8:01 PM by hasvi

    KT list with Page number

    Brave heart

      Hi,

      I want generate report of KT Character Style with Page numbers. But it showing some error, please anyone help me for this.

      Picture 5.png

       

      Thanks in advance,

      Brave heart

        • 1. Re: KT list with Page number
          Chinnadk Level 4

          If possible put your scripts here as text instead of image.

          • 2. Re: KT list with Page number
            Brave heart Level 1

            Hi Chinna,

             

            Please see the below script text as your need. Please help me...

             

             

            var mySourceFolder = Folder.selectDialog("Choose a sourceFolder");  

            if(mySourceFolder != null){  

                    var myDestinationFolder = Folder.selectDialog("Choose a destination folder");  

                    if(mySourceFolder !=null){

                            myDisplayDialog(myDestinationFolder, mySourceFolder);

                    }  

             

             

            }  

             

            function stripExt (f) {  

                    return f.substring(0,f.length-4);  

             

            }

             

            function myDisplayDialog(myDestinationFolder, mySourceFolder){

            var myArray = new Array;

            app.findTextPreferences = app.changeTextPreferences = null;

            app.findTextPreferences.appliedCharacterStyle = "KT"

            var myFound = myDoc.findText()

            for (i = 0; i<myFound.lenght; i++){

                var myFindKT = myFound[i].contents + "\t" + myFound[i].parentTextFrames[0].parentPage.name + "\r"

                myArray.push(myFindKT)

                }

            }

            var myTextFile = new File(myDoc.filePath + "/KT_Report.txt")

            myTextFile.open("w")

            myTextFile.writeIn(myArray)

            myTextFile.close();

            alert("Process Completed");

             

            Thanks in advance

            Dinesh

            • 3. Re: KT list with Page number
              Larry G. Schneider Adobe Community Professional & MVP

              You mean besides the misspelled word "length".

              • 4. Re: Re: KT list with Page number
                Chinnadk Level 4

                Hi Dinesh,

                 

                Your script is incomplete. Try the below one.

                 

                var mySourceFolder = Folder.selectDialog("Choose a sourceFolder"); 
                myDisplayDialog(mySourceFolder);
                alert("Process Completed");
                function myDisplayDialog(mySourceFolder)
                {
                    var files = mySourceFolder.getFiles("*.indd");
                    for(var i =0;i<files.length;i++)
                    {
                            var myFindKT = "";
                            var doc = app.open(files[i]);
                            app.findTextPreferences = app.changeTextPreferences = null;
                            app.findTextPreferences.appliedCharacterStyle = doc.characterStyles.item("KT");
                            var myFound = doc.findText();
                            app.findTextPreferences = app.changeTextPreferences = null;
                            for (j = 0; j<myFound.length; j++)
                            {
                                    myFindKT += myFound[j].contents + "\t" + myFound[j].parentTextFrames[0].parentPage.name + "\r"
                                }
                            var myTextFile = new File(doc.fullName.toString().replace(".indd", "_KT_Report.txt"))
                            myTextFile.open("w")
                            myTextFile.write(myFindKT)
                            myTextFile.close();
                        }
                }
                

                 

                Regards,

                Chinna

                • 5. Re: KT list with Page number
                  hasvi Level 1

                  script works perfectly.

                  by

                  hasvi

                  • 6. Re: KT list with Page number
                    hasvi Level 1

                    Hi chinna,

                     

                    your script is working fine, but 'italic', 'bold' details are missing in 'KT_Report.txt' because of save format is '.txt', so I have changed save format as '.doc', here my output log report saved in doc format but 'italic', 'bold' details are missing in doc file.

                    Is there any possible to get my 'italic', 'bold' details in 'KT' style?

                     

                    by

                    hasvi