Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi @Hetal5C4C ,
don't think, that's possible by scripting. At least not reliably.
What you can watch with an idle task are changes of the active spread or active page in the layout window.
But well, it could be that this would not correspond with the visible page or spread in the layout window.
https://www.indesignjs.de/extendscriptAPI/indesign-latest/#LayoutWindow.html
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
FWIW: If one scrolls through the layout window of a document one could see a change in page numbers in the normal GUI of InDesign. That's a control at the bottom of the layout window. If that is not reliable for you, my guess is, that a script could* could not be more precise…
Regards,
Uwe Laubender
( Adobe Community Professional )
[*] EDITED. My. Obviously I had not enough coffee this morning…
Copy link to clipboard
Copied
Thanks @Laubender
Page number shown at the bottom panel is reliable, but my client wants to see it in bigger view. So thinking to show it in the panel.
Can you please suggest which Constants/Event s I can attach with the layout window to get the active window page number.
Copy link to clipboard
Copied
As already said: look into idle task.
Read into this thread here to see an example with idle task for a different purpose:
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
I was also looking for such an event, but here is the best I found. Scripts don't work well with events, and to create plugin is too expensive...
File name: displayedPage.jsx
#targetengine displayedPage
/**
Put this file into "startup scripts" and reload ID.
When you change active page the message about page number appears...
However, the page becomes active only if a selection appears on it.
Unfortunately simple scrolling does not trigger an events.
*/
function displayedPage(){
app.addEventListener('afterOpen', function(event){
if (event.parent instanceof LayoutWindow) {
var aDoc = app.activeDocument;
var lWindow = event.parent;
alert('Document name: ' + app.activeDocument.name);
lWindow.addEventListener('afterAttributeChanged', function(wevent){
var l_window = wevent.parent;
alert("Displayed Page: " + l_window.activePage.name);
});
}
});
/**
This function is required, otherwise, the script will work even after deletion!
*/
app.addEventListener('beforeQuit', function(){
app.eventListeners.everyItem().remove();
});
}
displayedPage();