2 Replies Latest reply on Feb 22, 2015 9:27 PM by johnp45247251

    check paragraph is present or not  in story

    johnp45247251 Level 1

      Hi,

       

       

      In my document have one story and it contains 10 paragraphs.

       

      I need for, how to check paragraph is present or not in story 1.

      my coding is shown below, please tell this is right or not?

       

      tell application "adobe indesign cc 2014"

           tell active document

                tell story 1

                     repeat with i from count of paragraph to 1 by -1

                          if paragraph i is in story 1 then-----------------> here, what i do?  how to check the condition paragraph is present or not?

                               set a to 1

                          end if

                     end repeat

                end tell

           end tell

      end tell

       

      please help me.

      thanks by

      john peter.

        • 1. Re: check paragraph is present or not  in story
          johnp45247251 Level 1

          Hi,

           

          the above question is continued for,

           

          tell application "adobe indesign cc 2014"

               tell active document

                    tell story 1

                         repeat with i from count of paragraph to 1 by -1       ----------     count of paragraph is 10

                              if paragraph i is in story 1 then

                                   delete paragraph i

                                   delete paragraph (i-1)----->here i am deleting the paragraph 10 and 9, next repeat of i value, error was occured ---can't get paragraph 9 of story id 215 of document id 4.

                          

                         end if

                         end repeat

                    end tell

               end tell

          end tell

           

           

          please help me.

          thanks

          john peter.

          • 2. Re: check paragraph is present or not  in story
            johnp45247251 Level 1

            Finally i got the answer.

             

            tell application "adobe indesign cc 2014"

                 tell active document

                      tell story 1

                           repeat with i from count of paragraph to 1 by -1       ----------     count of paragraph is 10

                                if i < (count of paragraphs ) and i > 0 then

                                     delete paragraph i

                                     delete paragraph (i-1)

                                end if

                           end repeat

                      end tell

                 end tell

            end tell