Copy link to clipboard
Copied
Is there any way, when you have multiple documents open, to 'sync' the view (page, zoom level, scroll bar position) across every doc? Has anyone come across a script that can do this, or know of some other way to do it?
If I could 'retrieve' the horizontal and vertical scroll bar positions somehow I could probably write a keyboard maestro macro that would do it.
Copy link to clipboard
Copied
Hi @MrZZY this is something I have always wanted to do! Unfortunately, unlike Illustrator, we can't control the positioning of the viewport in Indesign. At least not directly.
However, a while back I came up with an approach which—while not ideal—is still very useful (to me at least).
See my Synchronize All Documents Text Selection script on my github repo. I use this frequently when I have multiple documents that all have matching "bones" eg. each document has the same basic subheads. To use it, select one of those matching subheadings and run the script.
Let me know if it helps in your situation.
- Mark
Copy link to clipboard
Copied
Thanks for this. Not quite what I was looking for, but very handy, I'll keep it in my scripts and see how much I use it, but certainly useful for some multiple similar-doc editing scenarios!
Copy link to clipboard
Copied
Hey there,
I’m not certain if we can access all the points you’ve mentioned using Extendscript. While it’s definitely possible to achieve this through a plugin, it’s a more complex task. However, there are a few things we can consider here.
Jean-Claude Tremblay created a fantastic script that compares two documents. When both documents are opened, the palette (as shown in the attached picture) allows you to navigate and scroll simultaneously on both windows. This means he’s found a way to at least adjust the zoom and scrolling together. I’d say this is a promising start.
Here’s the link to his script:
Hope it’ll help (at least a bit)
Fred
Copy link to clipboard
Copied
I'm currently studying the SDK.
// Get front layout view.
InterfacePtr<IControlView> iControlView_frontView(Utils<ILayoutUIUtils>()->QueryFrontView());
if (iControlView_frontView == nil) return;
// Get front document.
IDocument* iDocument_frontDocument = Utils<ILayoutUIUtils>()->GetFrontDocument();
if (iDocument_frontDocument == nil) return;
// Get IPanorama.
// Panorama handles the control of content position, scale, and scrolling within the view's display area.
InterfacePtr<IPanorama> iPanorama_frontView(iControlView_frontView, UseDefaultIID());
if (iPanorama_frontView == nil) return;
// Get the content-corrdinate location currently positioned at the top-left corner of the frame.
PMPoint frontView_topLeft = iPanorama_frontView->GetContentLocationAtFrameOrigin();
// Get scale factor.
PMReal xScale = iPanorama_frontView->GetXScaleFactor();
PMReal yScale = iPanorama_frontView->GetYScaleFactor();
// Get application interface.
// GetExecutionContextSession() returns a pointer to the ISession interface aggregated in the kSessionBoss.
InterfacePtr<IApplication> iApplication(GetExecutionContextSession()->QueryApplication());
// Get IDocumentList.
InterfacePtr<IDocumentList> iDocumentList(iApplication->QueryDocumentList());
for (int32 i = 0; i < iDocumentList->GetDocCount(); i++) {
// Get IDocument.
IDocument* iDocument = iDocumentList->GetNthDoc(i);
if (iDocument_frontDocument == iDocument) continue;
// Get IPresentationList.
// Each document knows the windows that are open on it by means of the IPresentationList interface on kDocBoss.
InterfacePtr<IPresentationList> iPresentationList(iDocument, UseDefaultIID());
if (iPresentationList->size() == 0) continue;
// Iterate through an IPresentationList.
for (IPresentationList::iterator iter = iPresentationList->begin(); iter != iPresentationList->end(); ++iter) {
if (*iter == nil) continue;
// Galley or Story view
if (Utils<IGalleyUtils>() && Utils<IGalleyUtils>()->InGalleyOrStory(*iter)) continue;
// Get IPanelControlData.
InterfacePtr<IPanelControlData> iPanelControlData(*iter, ::UseDefaultIID());
if (iPanelControlData == nil) continue;
// Get IControlView.
// kLayoutWidgetBoss is a BOSS representing a layout view.
IControlView* iControlView_layoutView = iPanelControlData->FindWidget(kLayoutWidgetBoss);
if (iControlView_layoutView == nil) continue;
// Get IPanorama.
InterfacePtr<IPanorama> iPanorama_layoutView(iControlView_layoutView, UseDefaultIID());
if (iPanorama_layoutView == nil) break;
// Replace the current scale factors with new values.
iPanorama_layoutView->ScalePanorama(xScale, yScale);
// Scroll so that a given content-coordinate point ends up at the top-left corner of the view.
iPanorama_layoutView->ScrollContentLocationToFrameOrigin(frontView_topLeft);
// Completed.
break;
}
}
Next step: Make it scriptable.
Copy link to clipboard
Copied
Hi 琥珀さん,
I don't really understand the level of detail here or what you have done, but I'd love to see the outcome if you manage to turn it into something scriptable that you can share. I looked into it on AI and it seems that perhaps you're writing a plugin that extends what InDesign can do. Given what others have said about InDesign not having the ability to deliver the type of 'viewport' specifics I stated in my initial post, your attempting this is a very exciting prospect.
I'd love to hear more if you progress with this.
Thanks again!
Copy link to clipboard
Copied
For now, I've made it scriptable and turned it into a plugin.
Windows, for the latest version of InDesign.
app.matchScrollZoomAllLayout();
Should work with this.
The method name is just a placeholder—let me know if you have any better suggestions.
GitHub URL
KohakuNekotarou/KohakuExtendScript
Please extract the zip file and place it in the plugin folder.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now