CreativePro Forum
Join our community of graphic designers, publishers, and production artists from around the world. Our members-only forum is a great place to discuss challenges and find solutions!
- You must be logged in to reply to this topic.Login
Find overlapping frames
- This topic has 15 replies, 4 voices, and was last updated 1 year, 5 months ago by
Nick Passmore.
-
AuthorPosts
-
-
May 4, 2024 at 8:39 am #14403115
Alicia
ParticipantIs there a way to find overlapping frames in InDesign? In a recent project a master page item was applied twice by accident, a running head text frame, so there was one sitting directly on top of the other. The text looked slightly darker and we had a hard time figuring out why! Only one of the frames showed up in the Layers panel because the other one was locked.
I was hopeful about this script:
https://stackoverflow.com/questions/33231516/indesign-javascript-to-find-overlapping-textframes
but I couldn’t get it to work. Thanks!
InDesign 2020, Mac Pro 2012 running High Sierra
-
May 4, 2024 at 9:00 am #14403116
Petar Petrenko
ParticipantJust manually remove overlaping frames on master pages.
-
May 4, 2024 at 11:36 am #14403117
David Blatner
KeymasterI think I may have fixed the script, and it works for me. You can download it here.
It only works with text frames.
-
May 6, 2024 at 7:14 am #14403122
Alicia
ParticipantThank you for the response! Unfortunately nothing happens when I try to run the script in InDesign 2020 on the Mac. I tried relaunching InDesign, and running other scripts. I also tried it on InDesign 2022 on a different computer. Is it likely that the problem is the older versions of InDesign?
-
May 6, 2024 at 8:15 am #14403124
David Blatner
KeymasterI don’t think the version is the problem. Remember, it only looks for two text frames that are overlapping on a page. If you draw a text frame and then duplicate it so that it’s mostly overlapping and run the script… nothing happens?
-
May 6, 2024 at 8:36 am #14403126
Alicia
ParticipantOh, yes, that does work! But not if the frames are the same size and Y coordinate, and not if one of them is locked to the master page. The script does find text frames that are the same size and X coordinate.
In our case the master page running head text frames were applied twice by accident, we think, and the one on top was unlocked.
Is there a way to search for locked master page items? I guess hiding each individual item in the Layers panel shows the master page locked items, but it would have to be done one spread at a time.
-
May 6, 2024 at 8:42 am #14403127
David Blatner
KeymasterHm… yeah… I can’t think of an easy way to do that. Maybe someone else here can. Good luck!
-
May 7, 2024 at 2:38 am #14403157
Nick Passmore
ParticipantYou can certainly list master page items:
tell application id “com.adobe.InDesign”
tell document 1
set MPI to (master page items of every page)
end tell
end tellThat will give you something like this:
{{}, {text frame id 888 of master spread id 213 of document id 1}, {}, {text frame id 888 of master spread id 213 of document id 1}, {}}
You could then “free” an individual item like this:
tell application id “com.adobe.InDesign”
tell document 1
set o to (override item 1 of item 2 of MPI destination page page 2)
detach o
end tell
end tellBut you would need a bit of logic to decide which items to override. Do the ones you want to remove have any other characteristics that could be used? An object style say? Then for those items you could say is there a “live” page item with the same xy coordinates? if so override, detach and delete? Or do you want to delete the overridden one?
Is this a problem on hundreds of pages?
-
May 7, 2024 at 6:52 am #14403162
Alicia
ParticipantThanks, Nick, it’s not really a question of overriding locked items; the problem is that we have a duplicate unlocked text frame on top of a locked text frame because the master page was applied twice by accident. The locked item is basically invisible because it’s an exact duplicate.
But I think a simple solution would be to make a copy of the file and move the items on the master page out of the way and then check for duplicates.
I appreciate your help, though!
-
May 8, 2024 at 1:38 am #14403218
Nick Passmore
ParticipantWhatever works of course — I was thinking you wanted to remove the locked text frame from underneath the unlocked one, to do which you would need to unlock it first.
It proved an interesting rabbit hole though. Even after all these years I realised I didn’t entirely understand the difference between overriding and detaching master page items.
(In fact I’m still not sure what the state of a page item derived from a master page item is when you can alter its text content but its geometry will still reflect a change made on the master page . . . every day really is a school day I suppose.)
Nick
-
May 8, 2024 at 6:29 am #14403223
Alicia
ParticipantOh, now I see what you mean about unlocking the locked frames, Nick! That may well be a necessary step. My co-worker pointed out that my solution won’t work if there are two unlocked frames on top of each other, so I’m still floundering!
-
May 9, 2024 at 12:26 am #14403265
Nick Passmore
ParticipantIs the document confidential? If not, or if you can make a redacted copy with just an example of the problem, I’d be happy to have a look.
And which frame do you want to remove — the already unlocked one or the one still locked?
I’m in the UK by the way so our waking hours may be out of sync.
Nick
-
May 9, 2024 at 8:04 am #14403270
Alicia
ParticipantThank you, that would be great! Here’s a Dropbox link:
The issue is in the running heads on pages 504–505. On page 504 one of the text frames is locked and the other is unlocked. On page 505 both of them are unlocked.
The problem is locating the duplicate text frames, so we could see where they are and decide what to do. In our design text frames should never overlap at all, so a script that finds text frames overlapping by any amount would work in this case and also when one frame is larger and hiding a smaller frame. We wouldn’t want the script to make changes, just show us the problem frames.
So the script would find the first overlapping text frame in the file and we would fix it manually, then we would keep running the script until no overlapping text frames are found.
Or the script could give a list of pages with overlapping text frames.
In his post on this thread David Blatner fixed up a script that finds unlocked overlapping text frames except those that are the same size and Y coordinate (so not if either or both of the frames is locked to the master page and not if their size and position match exactly).
app.activeDocument.viewPreferences.rulerOrigin=RulerOrigin.SPREAD_ORIGIN;
//If you are going to work with pages, not spreads, change the line above to PAGE_ORIGIN;
for (a = 0; a < app.activeDocument.spreads.length; a ++) {
var pg = app.activeDocument.spreads [a];
for (b = 0 ; b < pg.textFrames.length; b ++) {
var r1 = pg.textFrames [b];
for (c = 0 ; c < pg.textFrames.length; c ++) {
var r2 = pg.textFrames [c];
var gb1 = r1.geometricBounds;
var gb2 = r2.geometricBounds;if ((r1 != r2) &&
(gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [1] > gb2 [1] && gb1 [1] < gb2 [3]) ||
(gb1 [2] > gb2 [0] && gb1 [2] < gb2 [2] && gb1 [1] > gb2 [1] && gb1 [1] < gb2 [3]) ||
(gb1 [0] > gb2 [0] && gb1 [0] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3]) ||
(gb1 [2] > gb2 [0] && gb1 [2] < gb2 [2] && gb1 [3] > gb2 [1] && gb1 [3] < gb2 [3])) {
r1.select ();
var cnf = confirm ("Text frames overlap. Continue searching?", true, "Overlapping text frames");
if (!cnf)
exit ();
}
}
}
}Here’s the source of the original script:
https://stackoverflow.com/questions/33231516/indesign-javascript-to-find-overlapping-textframes
I know nothing about scripting and have no idea of how big of an ask this is, so no hard feelings if it’s more than you want to get into!
-
May 10, 2024 at 5:51 am #14403311
Nick Passmore
ParticipantHello Alicia.
So, I wrote something that can find any “live” text frame that contains a first paragraph with either “rhr” or “rhv” paragraph style applied and that overlaps a similar text frame on its own page or a master page. (Despite my blind spot about xy coordinates!)
It shows a dialog box once it’s done and also copies the list of page numbers to the clipboard.
It’s crude and probably fragile and on a long document may be a bit slow. It makes no changes to the document so it should be safe but obviously try it on a copy.
I don’t know how many variations on the running headers there are but if this doesn’t work I wonder if you could just temporarily add a few red blobs to the running headers on the master pages then look for pages where the blobs have not pushed the running header text to one side ?
By the way, I see from the extended file info that this document was created from a Quark XPress file in 2015! If I were you I would do an export to and open from IDML because there could be a lot of crud hidden there.
Nick
-
May 10, 2024 at 5:53 am #14403317
David Blatner
KeymasterSorry the post got held for moderation, Nick. That sometimes happens on our forum.
Also, if you want to include code here, you can surround it with either code or pre html tags, and that keeps it clean. -
May 10, 2024 at 6:18 am #14403319
Nick Passmore
ParticipantAh, thanks David. I wondered where it had gone.
It seemed a bit long to include in the post (and messy to be honest) but noted for future reference.
Nick
-
-
-
AuthorPosts
- The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
