Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Current Page

Return to Member Forum

  • Author
    Posts
    • #1223128

      Hi there,

      Salutations.

      To get the first page of the document we use, var myPage = myDoc.pages.item(1).

      What would be the code for getting the current page of the document?

      Thanks in Advance.

      RK

    • #14323277
      Robert Ploch
      Member

      Hi,
      first of all to get the first page in document you should use: myDoc.pages.item(0) ….. :)

      If I properly understand your idea, CURRENT page is one of currently visible pages ?

      If, so try this code:

      app.activeWindow.activeSpread.pages[n];

      n – corresponds to one of pages from which is the spread ( one or more pages) consist.
      0 is the first one

      regards
      Robert

    • #14323266

      There is also the parentPage property of a textFrame. Handy if your script is looping through many pages .

      For instance this :

      var currentPage = myParagraphs[i].parentTextFrames[0].parentPage;

      would set the currentPage variable to the page of the paragraph’s initial insertionPoint.

      In much the same manner you could find the current page of a character, a textstyle range, a footnote, a note, an anchored object etc.

    • #14323263

      No need to use activeSpread for a single page, LayoutWindow also has an activePage property. See https://www.indesignjs.de/extendscriptAPI/indesign-latest/#LayoutWindow.html (your handy first Go To for all such questions).

    • #14323258
      Robert Ploch
      Member

      Hi Theunis,
      thank you for very accurate remark, I’ve missed that property :)

    • #14323252

      Yes, Theunis
      activePage is a handy property for getting that one specific page.
      The only thing that bothers me about this is that if you have your zoom fit to spread then the active page is automatically set to the left one. Even if you have a selection on the right hand page. To make the right hand page the active one I must move the spread a bit to the left.
      It could be that I am doing something wrong, but this has bothered me so much that I would rather get the current page from a selection on the page.

Viewing 5 reply threads
  • You must be logged in to reply to this topic.
Forum Ads