• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Get page no from insertionpoint.

Community Beginner ,
Jan 16, 2009 Jan 16, 2009

Copy link to clipboard

Copied

Hi all,

I want to find (return) the page with the given insertion point. The insertion point may be present in a textframe or in a group or in a group within a group, etc..,

Is it possible to get the return type of the object?

thanks,
Hemi
TOPICS
Scripting

Views

595

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Beginner , Jan 01, 2023 Jan 01, 2023

Here’s what I have that works in my code, starting from an insertionPoint that is defined by a story.findText() call:

 

 

var this_insertionPoint = finds[0].insertionPoints[-1];
var this_absolute_page = this_insertionPoint.parentTextFrames[0].parentPage.documentOffset;
var this_page = doc.pages[this_absolute_page];
var this_side = this_page.side;

 

Votes

Translate

Translate
Community Expert , Jan 01, 2023 Jan 01, 2023

.documentOffset starts at 0, so I think you’ll need +1

 

 

 

 

var searchRes = styleSearch("Hello World")
if (searchRes.length > 0) {
    var ip = searchRes[0].insertionPoints[-1].parentTextFrames[0].parentPage
	alert("Last Insertion Point of first found text is on absolute page " + (ip.documentOffset+1) + "\rPage is on: " + ip.side.toString() + " Side of Spread" )
} 

/**
* Find Text 
* @ param Text to search for 
* @ return search results as an array 
*/
function styleSearch(f){
    app.findTe
...

Votes

Translate

Translate
Community Expert ,
Jan 16, 2009 Jan 16, 2009

Copy link to clipboard

Copied

There have been several examples of this in this forum recently. You'll find them using the forum search or Google. Also, please state your InDesign version and what script language you use.

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 16, 2009 Jan 16, 2009

Copy link to clipboard

Copied

Hi Peter,

Version CS3. Either javascript or vb.net

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 16, 2009 Jan 16, 2009

Copy link to clipboard

Copied

see: http://www.adobeforums.com/webx/.59b77ee3/6

For the most recent thread on this topic.

Dave

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

This link no longer works, and I’m having a devil of a time trying to find a relevant article using the search features. If you have it handy, can you relink?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

Though poking around the object model, I think I have it!

 

this_insertionPoint.parentTextFrames[0].parentPage.side, which is read-only, and results in one of the following…
  • PageSideOptions.LEFT_HAND
  • PageSideOptions.RIGHT_HAND
  • PageSideOptions.SINGLE_SIDED

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

Hi @Chris Noessel_731 , This returns the insertion point’s absolute page number—

 

var ip = app.activeDocument.selection[0].parentTextFrames[0].parentPage.documentOffset+1
alert("Insertion Point is on absolute page " + ip)

 

Also, this thread is from 2009, so maybe start a new thread if the above doesn’t work for you.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

Here’s what I have that works in my code, starting from an insertionPoint that is defined by a story.findText() call:

 

 

var this_insertionPoint = finds[0].insertionPoints[-1];
var this_absolute_page = this_insertionPoint.parentTextFrames[0].parentPage.documentOffset;
var this_page = doc.pages[this_absolute_page];
var this_side = this_page.side;

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 01, 2023 Jan 01, 2023

Copy link to clipboard

Copied

.documentOffset starts at 0, so I think you’ll need +1

 

 

 

 

var searchRes = styleSearch("Hello World")
if (searchRes.length > 0) {
    var ip = searchRes[0].insertionPoints[-1].parentTextFrames[0].parentPage
	alert("Last Insertion Point of first found text is on absolute page " + (ip.documentOffset+1) + "\rPage is on: " + ip.side.toString() + " Side of Spread" )
} 

/**
* Find Text 
* @ param Text to search for 
* @ return search results as an array 
*/
function styleSearch(f){
    app.findTextPreferences = app.changeTextPreferences = app.findChangeTextOptions = null;
    app.findTextPreferences.findWhat = f;
    return app.activeDocument.findText()
}

 

 

 

 

Screen Shot 12.png

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 02, 2023 Jan 02, 2023

Copy link to clipboard

Copied

LATEST

Hi @Chris Noessel_731 ,

note that the original thread is from 2009 and the question revolved around InDesign CS3 version 5.

To get the page of a given pageItem has changed with InDesign CS5 version 7. And stays with us until now.

Property parentPage was introduced with InDesign CS5. Its value will become null if the object is considered outside of the page on the pasteBoard.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines