2 Replies Latest reply on Jun 13, 2013 2:46 AM by DriveFST

    solution to using parent statement in CS3

    DriveFST

      Dear forum!.

       

      I have found trouble in using term "parent" in script esp. in CS3. wherelse in CS5.5 it works like a honey.

       

      And honestly to say, this taken from the discussion of Mr. Jump_over ...

       

      app.findTextPreferences.findWhat = "text";

      app.changeTextPreferences.changeTo = "Material";

       

      myFound = myFrame.findText();

      var k = myFound.length;

      while (k--)

       

      if (myFound[k].parent.constructor.name !== "Cell")

       

      myFound[k].changeText();

       

      It doesn't works in CS3. (ESTK highlights on if (myFound[k].parent.constructor.name !== "Cell") and says "undefined is not an object";

       

      I guess, the problem may because of the term Parent. Well in CS5.5 this error has not been encountered.

       

      thanks,

      @Chand...

        • 1. Re: solution to using parent statement in CS3
          Jump_Over Level 5

          Hi,

           

          I think is not about a "parent" but "constructor.name".

          I am not experienced with CS3 but you could try use this:

          while(k--) {
               try {
                    myFound[k].parent.parentStory;     // error if parent == "Cel" so omited
                    myFound[k].changeText();
                    }
               catch (e) { continue }
               }
          

           

          Jarek

          • 2. Re: solution to using parent statement in CS3
            DriveFST Level 1

            Fantastic Jarek!, The Genius work!

             

            Instead, i can able to do it,

             

            while(k--) {

                if (myFound[k].parent.constructor.name !== "Cell")

            //     try {

                     // myFound[k].parent.parentStory;     // error if parent == "Cel" so omited

                      myFound[k].changeGrep();

                      }

             

             

            SPlendid, thanks to you.

             

            @Chand