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;
.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
...
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
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?
Copy link to clipboard
Copied
Though poking around the object model, I think I have it!
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.
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;
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()
}
Copy link to clipboard
Copied
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 )