Skip to content

Instantly share code, notes, and snippets.

@moluapple
Created August 5, 2012 09:27
Show Gist options
  • Save moluapple/3263337 to your computer and use it in GitHub Desktop.
Save moluapple/3263337 to your computer and use it in GitHub Desktop.
[Indesign] get a paragraph's index within it's parent textframe
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (item, i) {
i || (i = 0);
var length = this.length;
if (i < 0) i = length + i;
for (; i < length; i++)
if (this[i] === item) return i;
return -1;
}
}
var p = app.selection[0],
inxs = p.parentTextFrames[0].paragraphs.everyItem().index,
inx = p.index;
alert(inxs.indexOf(inx) + 1);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment