4 Replies Latest reply on Nov 4, 2011 7:21 AM by sotospeak (carlo bazzo)

    changed in CS5.5 ?

    sotospeak (carlo bazzo) Level 1

      I have a grid of textframes in a spread for testing.

       

      I need to know which tf is on the right side and which on the left side of the spread.

       

      I thought to compare the tf parent arguing that the page should be different. I used the getPage function by Marc Autret: well in ID CS4 everything is working as I expected. If I select a tf on the left side I get "Page:6" and if I select one tf on the right I get "Page:7".

       

      But in ID CS5.5, any tf I select I get "The textframe is placed on a spread!".

       

      Maybe someone can explain what is changed in ID 5.5 with this respect? Thank you.

       

      Here is the code:

       

      TextFrame.prototype.getPage = function()

      // -----------------------------------------------

      // Returns the containing Page of this TextFrame

      {

      var p = this.parent,

           pc;

      while( pc=p.constructor )

           {

           if( pc == Page )

                return p;

           if( pc == Spread || pc == MasterSpread )

                throw Error("The textframe is placed on a spread!");

           if( 'parentTextFrames' in p && !(p=p.parentTextFrames[0]) )

                throw Error("The textframe's container overflows!");

           p=p.parent;

           }

      }

       

      // Sample code (assuming a text frame is selected)

      // -----------------------------------------------

      var tf = app.selection[0],

           pg;

          

      try {

           pg = tf.getPage();

           alert(tf.parent.parent);

           alert( "Page: " + pg.name + " Side: " + pg.side);

           }

      catch(e)

           {

           alert( e );

           }