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.
Copy link to clipboard
Copied
Hi @琥珀 猫太郎 this sounds super useful! I'm not sure if I'm installing it correctly, but I can't get it to work...
I put the pln file here:
but when I try the ExtendScript call, I get an error that the method doesn't exist:
Am I doing something wrong?
- Mark
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Ah I think plug-ins must be compiled for the platform they run on. So we would need to compile for Apple Silicon using Xcode. I have Xcode and I can download the SDK, but I think it might be a lot of work for me as a raw beginner with SDK. @Dirk Becker do you use MacOS? Am I correct in my rough understanding?
Copy link to clipboard
Copied
@m1b In short, you're roughly correct.
I'm mostly working on Mac, but recently also got the first PC in years, for Windows 11. Before that I used virtual machines on Intel Mac for both Mac and Windows builds.
That requirement "compiled for the platform" is only the beginning. You might get thru with any / the latest of VStudio and Xcode, but the InDesign SDK specifies particular compiler versions for a reason. Those aren't usually the latest, but rather a year back (when a new InDesign major version comes around) or even more. That's because Adobe also has to test the compiler versions, update all their internal libraries down to the applications themselves.
While in the recent years compilers have been more stable than 15 years ago, we've just reached a moment where things are shifting again. Newer language versions bring new features, and Adobe actually starts to use them. See a recent thread with "K2_BE_GONE".
As we're talking about compilers, those also have their requirements - a minimum OS version is specified, while you later on also observe a maximum. More so on the Mac, while Windows has other issues – look around for "xlocnum hack".
The compiler also comes with an OS SDK, which again has version dependencies. On Windows you may install multiple VStudio versions (only in sequence of older … newer) but years ago I've also experienced that after such attempts neither worked. Rolled back a VM snapshot and my Windows 7 Ultra license fell apart with all the accumulated application version history. There are special licenses to deal with that, look for MSDN or nowadays those go as VStudio Pro subscription.
I've already mentioned virtualization. After moving away from VMware I have recently spent far too much time on getting used to UTM, work around its limitations, tracking and downloading installers – for OS, Xcode and InDesign versions, associated SDKs. At least with InDesign major versions, you better start over with a new system rather than inherit oddities that will only show on user machines. Linking to that old runtime library that won't be provided by newer OS versions. Downside of starting over is you also have to restore those settings, and better know why you set them in the first place.
Plenty other things to observe, but you get the idea.
Sure you can take shortcuts, especially if you're building only for yourself.
Copy link to clipboard
Copied
Thanks @Dirk Becker that's very interesting... and sobering! It certainly sounds a bit beyond a beginner like me to attempt. Oh well.
@琥珀 猫太郎 perhaps you could post the source files on your github repo? That way someone could make the attempt to compile for Apple Silicon if they were able to.
Copy link to clipboard
Copied
I did not mean to fully discourage you. Just be prepared that things don't always go smoothly.
Others don't bother with all those details of older versions, e.g. grab the latest VStudio VM on Azure and hope everything works. Or in your case, go with the closest Xcode version that matches the SDK minimum and runs on your Mac. It takes just more effort if you have to maintain that project across many versions for multiple years.
One note to @琥珀 猫太郎 - if you publish the plug-in, please make sure to use IDs that you have allocated thru wwds at adobe, including both prefix IDs and script IDs.
Copy link to clipboard
Copied
How do I do it?
Copy link to clipboard
Copied
Use mail.
wwds at adobe dot com
Say you need a prefix ID and the script IDs
four-char-code, name of your property, method etc.
Copy link to clipboard
Copied
I uploaded the source.
Copy link to clipboard
Copied
This looks great but I'm on Indesign Mac, I'm guessing there's no easy way to get this going on Mac too? (I suspect m1b is on MacOS too).
Find more inspiration, events, and resources on the new Adobe Community
Explore Now