Since no one replied, I reinvented it. :^)
The motivation for the the script is that we receive review comments from our authors as a list or spreadsheet with page and paragraph references (p12, para4, change this to that) and it save a lot of time to be able to jump directly to that specific page when applying the edits. The paragraph is highlighted to make it easy to find on the page. Thanks to Peter Kahrel for a snippet that creates a new text condition.
//DESCRIPTION: Jumps to a specified paragraph on a page. The location is specified in a dialog box in the form page.paragraph
//For example, to jump to the fourth paragraph on page 16, use 16.4
//The specified paragraph is highligthed using conditional text. Tested in InDesign CS5.5.
//
//AUTHOR: Perry Donham, pd@kidpub.com, books.kidpub.com
//Version: 1.0.0
main();
function main(){
var kAppVersion = parseFloat(app.version);
//This is the color we'll use (it's light green)
//
var highlightColor = [200,255,200];
//Set up the condition
//
var highlightCondition = add_condition(app.documents[0], 'Edits', highlightColor);
//Display the dialog
//
var d=app.dialogs.add({name:”Jump To Page.Paragraph:”});
//Changed from integerEditBoxes to textEditBoxes
with (d.dialogColumns.add()) {
var numberBox = textEditboxes.add({minWidth:60});
}
var userInteract = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
var result = d.show();
app.scriptPreferences.userInteractionLevel = userInteract;
if(!result){d.destroy();return}
//Parse out the paragraph and page numbers using split. The form is page.paragraph
//
var pagepara = numberBox.editContents;
var mySplitResult = pagepara.split('.');
var selectedParagraph = mySplitResult[1];
var selectedPage = mySplitResult[0];
//Jump to the page
//
if (app.activeDocument.pages.length > selectedPage) {
var thePage=app.activeDocument.pages[selectedPage – 1];
app.activeWindow.activePage=thePage;
}
else {
alert(“The document does not have that many pages”);
return;
}
//Get the text frame on the page
//
var theFrame = thePage.textFrames[0]; //should be only one
//Get the paragraph in the frame
//
if (theFrame.paragraphs.length > selectedParagraph) {
var theParagraph = theFrame.paragraphs[selectedParagraph – 1];
}
else {
alert(“The page does not have that many paragraphs”);
return;
}
//Set the condition
theParagraph.applyConditions([], true);
theParagraph.applyConditions(highlightCondition);
//We'll use conditional text to highlight the paragraph, which is only visible in Normal mode
//
app.documents[0].layoutWindows[0].screenMode = ScreenModeOptions.previewOff;
//Drop the dialog
//
d.destroy();
//This is from Peter Kahrel's 'deviations' script at https://www.kahrel.plus.com
//
function add_condition (doc, n, c)
{
if (doc.conditions.item (n) == null)
doc.conditions.add ({
name: n,
indicatorColor: c,
indicatorMethod: ConditionIndicatorMethod.useHighlight});
return doc.conditions.item (n)
}
}