4 Replies Latest reply on Apr 7, 2014 6:32 AM by BEGINNER_X

    Selected TOC style Name

    BEGINNER_X Level 3

      Hi All,

       

      Simple question for you...

       

      How can I alert the selected TOC style name.

       

      We are creating huge tool. Based on the selection Toc Style, we will process the multiple document.

       

      For example I want to alert the Toc Style CCC(tick mark) name in this document.

       

      Trying Code:

       

      var myTocStyle = app.activeDocument.tocStyles.selectedIndex;

       

      //~ var myTocStyle = app.activeDocument.tocStyles.item(-2);   //Dont want this concept

       

       

      Screen Shot 2014-04-05 at 10.46.11 AM.png

      Very urgent request. Please help.

       

      Thanks

      Beginner_X

        • 1. Re: Selected TOC style Name
          BEGINNER_X Level 3

          Hi All,

           

          Gentle Remainder for my above request.

           

          Please help on this ASAP.

           

          Thanks

          Beginner_X

          • 2. Re: Selected TOC style Name
            Dave Saunders Level 4

            I'm having trouble understanding just what you're trying to do -- are you trying to "read" a value that the user chooses from a standard UI dialog? You can't do that.

             

            It's been a while since I've tried any TOC work, but I recall it used to be difficult to work out which TOC Style went with which TOC.

             

            Things might have improved since CS3 days. Can you say a little bit more about the process you're trying to serve here?

             

            Dave

            • 3. Re: Selected TOC style Name
              Dave Saunders Level 4

              From:

               

              myStory.storyType

               

              you can determine that a story is a TOC, but how do you get from there to the TOC Style that was used to create said TOC?

               

              This was the question that was bugging me back in CS3 days and I see no improvement in the CC object model. Stories don't have an associatedTOCStyle property. But maybe you can get at this by lateral thinking. If a story was created as a TOC then it has certain paragraph styles in it. If the TOC Styles are designed to have unique paragraph styles that identify the TOC Style, then you're home and dry. For example, you could have a ParagraphStyleGroup for each TOC Style and the name of that group could be the same as the name of the corresponding TOC Style.

               

              Of course, this assumes you have control over the template for the project so that this relationship can be relied on. But given that, you can start with a text selection. Check the applied paragraph style, look at the name of its parent and bingo: there's the name of the TOC Style.

               

              I'm not sure if this helps in your situation.

               

              Dave

              • 4. Re: Selected TOC style Name
                BEGINNER_X Level 3

                Hi Dave,

                 

                Thank you for your valuable reply.....

                 

                We also trying the same way, what you explain in the above thread.

                 

                Above thread should be very helpful information for me.

                 

                Any better solution is appreciable???

                 

                 

                Thanks

                Beginner_X