3 Replies Latest reply on Jun 10, 2010 4:32 AM by Philippe Requilé

    Page.TextFrames.Item problem

    Philippe Requilé

      I upgraded Indesign from CS1 to CS5.

      I reimported the type library in Delphi, and I did some minor changes in my delphi code (extra parameters, ...).


      When I try to find a text frame with

           IdTF := TextFrame(IdPage.TextFrames.Item['Versie']);

      then I get the error 'The requested member of the collection does not exist'.

      This code worked with Indesign CS1.


      When I check the label of my template with

               idTF := Indesign_TLB.TextFrame(IdPage.TextFrames.Item[1]);
               ShowMessage(Format('%d "%s"',[iIndex,idTF.Label_]));

      I see the label is correct ('Versie').


      Who can help?


      PS when importing then CS1 template file, all script labels were gone in the indt-file  and I had to re-edit them all.

        • 1. Re: Page.TextFrames.Item problem
          Andreas Jansson Level 2

          Wow... From CS1 to CS5 is quite a step!


          It seems that there are big changes to the label property and associated methods. As I read quickly now (editing my first message) it seems that there is a "name" property to use instead.


          "All scripts that use item("label") to get at stuff will have to be rewritten."


          See http://forums.adobe.com/message/2800152?tstart=0


          There is also code (javascript) describing how one can still get items by label, by using versioning and getElements().




          Message was edited by: Andreas Jansson

          1 person found this helpful
          • 2. Re: Page.TextFrames.Item problem
            Philippe Requilé Level 1


            If you want to find back a textframe in a textframes list (or a rectangle in a rectangles list), the parameter changed:

            f.e. Application.Page.TextFrames.Item['reference']

            - in CS1 'reference' is the script label (can be edited in indesign via window -> utilities -> script label)

            - in CS5 'reference' is the name of the item (can be edited in indesign via window -> Layers)


            That might also be the reason why CS5 removes the script labels while converting a document from CS1 to CS5.

            • 3. Re: Page.TextFrames.Item problem
              Philippe Requilé Level 1

              But I had a simple workaround with the script labels: I iterated through the list of textframes:

                iCount := TFList.Count;
                bFound := False;
                while (not bFound) and (iIndex<=iCount) do
                  TF := TextFrame(TFList.Item[iIndex]);
                  if TF.Label_=sLabel then bFound := True;