2 Replies Latest reply on Dec 19, 2008 11:53 AM by (Robert_Tkaczyk)

    [CS3][VB] Bug in myPage.Duplicate :(

    Level 1
      hi

      I try to duplicate page and get reference to object on newly duplicated page
      I do something like this - this procedure should place page from multipage-PDF to Labeled Rectangle on duplicated page - next page:

      Set myDestObject = FoundItem
      b = 1
      Do While True
      myInDi.PDFPlacePreferences.PageNumber = b
      Call myDestObject.Place(myPdfFile)
      If myInDi.PDFPlacePreferences.PageNumber <> b Then
      Call myPage.Delete
      Exit Do
      End If
      Set myPage = ReturnPage(myDestObject)
      ' (a)
      Set myPage1 = myPage
      ' (b)
      Set myPage1 = myPage.Duplicate(idLocationOptions.idAfter, myPage1)
      ' (c)
      ' Set myPage = myPage1
      ' (d)
      Set myDestObject = myPage.PageItems.Item(UCase(myLabel))
      b = b + 1
      Loop

      after 1st loop:
      in step (a) - myPage = '4' - what is right
      in step (b) - myPage1 = myPage = 4
      in step (c) - myPage1 = '4' and myPage = '5' ?? ?? ??
      step (d) have no sense

      so - myPage1 is original page - myPage is duplicated page

      after 2nd step:
      in step (a) - myPage = '5' - what is right
      in step (b) - myPage1 = myPage = 5
      in step (c) - myPage1 = '6' and myPage = '5' ?? ?? ??
      step (d) could help ...

      so - myPage1 is new-duplicated page - myPage is original page

      could anybody tell me what the hell is going on ?

      this is definition from VB ObjectBrowser:

      Function Duplicate([To As idLocationOptions = idAtEnd], [Reference]) As Page
      Member of InDesign.Page
      Duplicates the page.
      Return value: The duplicate page.
      To: The location at which to place the duplicate page relative to the reference object or within the document or spread.
      Reference: The reference object.
      Note: Required when the to value specifies before or after. as Page or Spread

      is it really the only solution to duplicate page AtEnd and then move it after original page?

      could anybody check this in other laguages - JS and AS ?

      [EDIT]
      this bug is only for "left" pages on spread - when original page is "right" page - it is duplicated OK - like in second step in my example - so new workaround could be - check for left/right page and "Set myPage = myPage1" make sense for right pages ;)

      robin

      --
      www.adobescripts.com