Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

[CC/Mac, JS] Palette looses layoutWindow focus when double clicking listbox items several times

$
0
0

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


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>