4 Replies Latest reply on Mar 19, 2008 8:37 PM by (rparimala)

    Find & Replace text in text frame,document in CS3

      Can anyone help me to find a text and replace in a text frame & document in CS3 using vb.net/javascript.
        • 1. Re: Find & Replace text in text frame,document in CS3
          Level 1
          did you try to find answer in old posts ??

          there is very long thread called "What was changed" or something like that

          and yesterday was thread about finding text in ID Server

          (I'm not JS man)

          robin

          --
          www.adobescripts.com
          • 2. Re: Find & Replace text in text frame,document in CS3
            Level 1
            Hi Robin,

            I have searched but examples were given in javascript but the intellisense of vb.net does not give those methods. In CS2, I have used the following one

            IDocument.Search("<AID>", False, True, Value) -- vb.net

            Whereas in CS3 I have used as

            Dim oFind As InDesign.FindTextPreference
            Dim str As Object = "<AID>"
            oFind = Nothing
            oFind.FindWhat = "<AID>"

            But this is throwing an exception. Can u help me on this?

            Thanks,
            Parimala
            • 3. Re: Find & Replace text in text frame,document in CS3
              Level 1
              I can give you only example in VB6:

              myInDi.FindTextPreferences = Nothing
              myInDi.ChangeTextPreferences = Nothing
              If Option1(0).Value Then
              myInDi.FindTextPreferences.AppliedCharacterStyle = FindCharStyle(L1.List(b))
              Else
              myInDi.FindTextPreferences.AppliedParagraphStyle = FindParaStyle(L1.List(b))
              End If

              myIndi.FindTextPreferences.FindWhat = text1
              myIndi.ChangeTextPreferences.ChangeTo = text2

              Set znal = myDoc.FindText()
              ' or
              Set znal = myDoc.ChangeText()

              more examples you should find in Scripts folder in your InDesign instalation directory

              robin

              --
              www.adobescripts.com
              • 4. Re: Find & Replace text in text frame,document in CS3
                Level 1
                Hi Robin,

                Thanks for the help. I've found the solution in .NET

                IApplication.FindTextPreferences = InDesign.idNothingEnum.idNothing
                IApplication.ChangeTextPreferences = InDesign.idNothingEnum.idNothing
                'Search the document
                IApplication.FindTextPreferences.findWhat = "Introduction" IApplication.ChangeTextPreferences.changeTo = "!!!!!!!!!changed!!!!!"
                IApplication.ActiveDocument.ChangeText()

                Parimala