🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2246

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

#2246
From: Robert Tkaczyk
Date: Fri, 19 Dec 2008 12:43
65 lines
2972 bytes
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
Technical Details
Message-ID: <C3BE51ADCE476BD16B6C53819D578BEF@in.webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,4ad6c15552514438,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Robert Tkaczyk <indesignscripts@wp.pl>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: [CS3][VB] Bug in myPage.Duplicate :(
Message-ID: <C3BE51ADCE476BD16B6C53819D578BEF@in.webcrossing.la2eafNXanI>
Date: Fri, 19 Dec 2008 04:43:39 -0800
Lines: 74
User-Agent: Thunderbird 2.0.0.18 (Windows/20081105)
X-Antivirus: avast! (VPS 081218-0, 2008-12-18), Outbound message
X-Antivirus-Status: Clean
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit