Hello!
My script collects all notes (»notes[]«) and displays them with [...].page.name and note.texts in a listbox of a palette (»new Window("palette", "Notes Browser", undefined, {resizeable:true})«). By double clicking an item, InDesign should select the invisible notes character and center the view at the right position in the layoutWindow. This works three or four times perfectly, then the rulers of InDesign are grayed out and a double click to a different listbox item does nothing any more.
Interestingly this version (without selecting anything) works perfectly:
function lstNoteItems_onDoubleClick(){ var idClicked = this.selection[0].id; var item2select = g.arrNoteItems[idClicked].storyOffset; showIt(item2select); } function showIt(theObj) { if (arguments.length > 0) { app.select(theObj); } var myZoom = app.activeWindow.zoomPercentage; app.activeWindow.zoom(ZoomOptions.showPasteboard); app.activeWindow.zoomPercentage = myZoom; }
But my script should select the invisible character. This does work three or four times and then InDesign looses a kind of focus:
function lstNoteItems_onDoubleClick(){ var idClicked = this.selection[0].id; var item2select = g.arrNoteItems[idClicked].storyOffset; var item2selectStory = g.arrNoteItems[idClicked].storyOffset.parentStory; // select note’s story var item2selectIndex = g.arrNoteItems[idClicked].storyOffset.index; // select note’s insertion point showIt(item2select); item2selectStory.characters[item2selectIndex].select(); } function showIt(theObj) { if (arguments.length > 0) { app.select(theObj); } var myZoom = app.activeWindow.zoomPercentage; app.activeWindow.zoom(ZoomOptions.showPasteboard); app.activeWindow.zoomPercentage = myZoom; }
Any suggestions?
Thanks
Tobias