Copy link to clipboard
Copied
It seems lndesign doesn't automatically continue a layout to subsequent page pairs when your typing in one column wraps to the next page. I was told I could script this, and since I have done JS scripting on web pages for a while, it should not be too hard, hopefully, if I explain the layout here?
The layout is simple -- 4 parallel columns spread across 2 facing pages -- each column will hold a separate text than the other 3, and these texts will NOT be pasted in -- they will be created AS I type. I can't find a word processor to do this, because none can wrap a column from one even page number to the next even page number (not the next odd page number). Yet if you think about the layout in the finished printed book, it is very obvious -- you want the two texts on the left page to always stay on the left, and the two on the right to stay on the right, no matter which page of the book you turn to.
So technically, column 1 of the even page 2 will wrap down to column 1 of page 4. Column 2 of the even page will also wrap down to page 4. Similarly, both the 2 right columns of the right (odd) page will always wrap down to the next odd page. All I need is for this to happen automatically as I type. So, whatever column I am typing into, when I reach the end of that column on the current page, the same layout will be created for the next page pair on the fly. So you just keep typing, and when ANY column hits the end of that page, a new page-pair layout will be created if it doesn't already exist.
This avoides page frame linking repetitively across hundreds of pages, which is an ongoing hassle that will detract from my concentration on the book's content. I want the layout to simply keep going in the background for as long as I type. Simple requirement -- can it be done in Javascript?
I really don't have the time to write free scripts right now, but if you want to put in the effort to write this yourself, this should get you started:
The basic skeleton of such a script would be something like this:
var bounds = app.selection[0].parentTextFrames[0].geometricBounds;
app.documents[0].pages.add();
app.documents[0].pages.add();
var nextFrame = app.documents[0].spreads[-1].textFrames.add({geometricBounds:bounds});
app.selection[0].parentTextFrames[0].nextTextFrame = nextFrame;
You need to
...Copy link to clipboard
Copied
Unless you are a VERY advanced scripter and use APID, the best you
will be able to do would be to run a script to add new frames each
time the text gets overset.
You could assign the script a shortcut, so it would be relatively
painless to run the script each time...
Harbs
Copy link to clipboard
Copied
Too bad. APID is? Is the script you mentioned (to click as a shortcut) complicated? Can you give any of it here?
I will be doing several books with parallel column layout, so I really want to find a program where you set up a layout once, and it auto-propagates itself. Other than our discussion on the other thread, and your suggestion there, do you know of any WPs or DTPs that can auto-propagate a fixed layout? Or any other ways to do it in scripting? After all, it is only page numbering -- but the on-screen layout is what I need to work with.
Copy link to clipboard
Copied
I really don't have the time to write free scripts right now, but if you want to put in the effort to write this yourself, this should get you started:
The basic skeleton of such a script would be something like this:
var bounds = app.selection[0].parentTextFrames[0].geometricBounds;
app.documents[0].pages.add();
app.documents[0].pages.add();
var nextFrame = app.documents[0].spreads[-1].textFrames.add({geometricBounds:bounds});
app.selection[0].parentTextFrames[0].nextTextFrame = nextFrame;
You need to make sure that the ruler origin is spread.
You will need to check if there's a page after the current one, and only add the page if necessary.
There's a whole pile of other error checking that you'd have to do as well.
HTH,
Harbs
Copy link to clipboard
Copied
Thanks Harbs, this is a useful start, and the first solid thing I have got so far.
Copy link to clipboard
Copied
We're a helpful lot, generally. Really!
As for your problem at hand, all you (hopefully!) have to do is modify the following script on one single little point. There might be more than 4 text frames on any page (I suppose...), so the script checks each one on the current spread for a certain minimum height in line 2. If the height is less than the number given (the sample shows "180", as I tested on an A5, and with millimeters), the frame will *not* be considered for linking. Don't worry if you don't get it right first time, as it also checks if the result *does* contain 4 frames, no more, no less.
If it does find 4 frames, it sorts them from left to right according to their x position, so it's ensured the new frames are linked to the correct ones. (I suppose that's a fairly crucial point.) It then adds two more pages, creates four more text frames, and links these to the ones on the parent page.
// Get frames on current spread
allFrames = new Array;
itsSpread = app.selection[0];
if (itsSpread instanceof InsertionPoint)
itsSpread = itsSpread.parentTextFrames[0];
if (itsSpread instanceof TextFrame)
itsSpread = itsSpread.parent;
if (itsSpread instanceof Page)
itsSpread = itsSpread.parent;
if (!(itsSpread instanceof Spread))
{
alert ("Got lost somewhere ... Please put your cursor IN the text");
exit(0);
}
// alert (itsSpread.constructor.name);
// alert (app.selection[0].parentTextFrames[0].parent.constructor.name);
for (a=0; a<itsSpread.textFrames.length; a++)
allFrames.push(itsSpread.textFrames);
// Discard small frames. Adjust for your document ...
for (a=allFrames.length-1; a>=0; a--)
{
if (allFrames.geometricBounds[2] - allFrames.geometricBounds[0] < 180)
allFrames.splice(a,1);
}
// alert (allFrames.length);
if (allFrames.length != 4)
{
alert ("Unable to find the 4 frames ...\n(Found "+allFrames.length+")");
exit(0);
}
// Sort on x
allFrames.sort (function(a,b) { return a.geometricBounds[1] - b.geometricBounds[1]; } );
// Dummy checking 😛
// for (a=0; a<4; a++)
// allFrames.contents += String(a);
// Add a page for frames 0,1
p = app.documents[0].pages.add();
// Add and link frames
bounds = allFrames[0].geometricBounds;
nextFrame = p.textFrames.add({geometricBounds:bounds});
allFrames[0].nextTextFrame = nextFrame;
bounds = allFrames[1].geometricBounds;
nextFrame = p.textFrames.add({geometricBounds:bounds});
allFrames[1].nextTextFrame = nextFrame;
// Add a page for frames 2,3
p = app.documents[0].pages.add();
// Add and link frames
bounds = allFrames[2].geometricBounds;
nextFrame = p.textFrames.add({geometricBounds:bounds});
allFrames[2].nextTextFrame = nextFrame;
bounds = allFrames[3].geometricBounds;
nextFrame = p.textFrames.add({geometricBounds:bounds});
allFrames[3].nextTextFrame = nextFrame;
// That, as they say, should be It.
Copy link to clipboard
Copied
Web Jive Editor strikes again. The line you should adjust is "22", and that's what I'm sure I typed! A reply rather than a post-edit, because I've seen Jive mangle edited posts beyond recognition
Copy link to clipboard
Copied
Jongware --- This is ABSOLUTELY TERRIFIC -- much more than I had hoped for. Thank you very much, the "correct answer" should surely have gone to you, but I expect it is too late to change it now.
You are right in assuming there might be more than 4 frames -- there of course needs to be gutters between adjacent column, don't know if I need more frames for those until I try it. But it sounds like you have already fielded that issue. And you are also right in assuming that the most crucial thing is to wrap each column down to the next-page+1 -- keeping the odd page columns on odd pages, and the even on even. That is really all there is to it.
So now do I run this script on start up after making the initial layout? Or can I attached the script to the layout starting at p.2? I want the script to automatically keep going, and I will have to experiment as to how to accomplish that. The 4 column layout starts on page 2, since page 1 is orphaned. And from pages 2-3, it just keeps going as long as I am typing.
Truly fantasic work. This has finally got me excited enough to get going with Indesign. I will keep you posted as it progresses. You not only made my day, but if it works as intended, you will have made my year !!!
Copy link to clipboard
Copied
Glad you like it!
So now do I run this script on start up after making the initial layout? Or can I attached the script to the layout starting at p.2?
As it is now, the script will only work on your spread with two pages, four columns. I strongly suggest you only try it on the very last page (/spread), as I have no idea what will happen when you use it on a spread that already has something following it!
To add a spread and have the frames continue, just make sure your text cursor is in one of the frames on your last page. Then double-click the script to insert a new spread after the current one (see above ...) and automatically link to it. If your currently visible text frames have any overset text, this will automagically appear on the new spread; otherwise, after running the script, you can just keep on typing and you'll jump over to the new spread when you fill the current frame.
Harbs hinted at a more complicated setup, where the script would be running continously (? I think) and adds pages whenever it sees an overflow. I don't have any idea at all how one would achieve that; perhaps it's something in the APID toolkit he referred to. With my script, you have to "manually" add a spread every time the current one is full, or ... (hold on while I test that... )
Okay. You have to be careful when adding pages! If you accidentally run the script twice, two more spreads will be added, and (quite logically, actually...) the frames on your current page will be linked to the last pages added, skipping the ones inbetween. So, with your text cursor inside a frame, don't run the script more than once -- the cursor determines 'from' what page to link, and it always links to the newly added pages.
You can still add a bunch of empty pages, but you'll have to be a bit more careful. The script also works with a text frame selected (using the black arrow); and in that case, the selected frame is the 'source' for the next link. So to add more than one spread, select a frame on your last pages; run the script, press [Page Down] (it seems ID automatically goes to the new pages, but you'd better keep an eye on the Pages panel), select a frame on this new spread and run the script again.
(Yup -- confirmed. Running the script on not-the-last-page messes up the text threading. Let me think.)
Aha! Text frames also have a property "endTextFrame", pointing directly to the final frame in its threads. Linking to that last frame always seems to work. If you change the "nextTextFrame" line four times, you'll no longer run the risk of making spaghetti of your threads:
allFrames[0].endTextFrame.nextTextFrame = nextFrame;
Copy link to clipboard
Copied
You are right in assuming there might be more than 4 frames -- there of course needs to be gutters between adjacent column, don't know if I need more frames for those until I try it.
My test setup was fairly simple: in the New Document dialog I changed the number of columns to "2", with some gutter. That makes ID draw guidelines for all four of your text frames. On your first spread, you have to manually draw the four frames, but after that you can run the script. Remember to change the minimum height it checks for -- the script only checks text frames, but you might have a callout box or figure caption or something like that on some pages.
You can't use the 'columns inside a frame' option (in Text Frame Options) because then InDesign will always have the text run from the left column to the right one. Four separate frames, and that should be it. Nothing additional needed for a gutter.
Copy link to clipboard
Copied
Oops, I didn't see that last post, it has largely answered what I asked, except for which frame of the 4 to be in, and how
to fix the script
Copy link to clipboard
Copied
OK, so let me get this straight. There are 2 columns on the left (even) page, and 2 on the right (odd) page. Say that column = frame here, but I imagine the leftmost frame can be made to include the gutter between its column and the next (ditto for the others). So are you saying that when I want to "wrap" down to the next page pair, the cursor has to be in the rightmost frame of the 4-frame spread? Or can it be in any of them?
It is no problem to click the script when I want to flow down, that is easy. And no, I would never click the script when I am on higher up pages, it will always be at the end of the text. So, for example, I wouldn't click it until I was approaching the bottom of page 2 (or 3), just tell me which column (frame) I have to be in to get it to flow correctly. As long as I know, then "no", I don't need a continuously running script.
Also, I am not sure exactly what lines to change with your edited liines above.
Copy link to clipboard
Copied
As it happens, it doesn't really matter in which frame your cursor is. The new pages are added, and all four frames are linked to the ones on the previous spread.
The four lines to change in are this section at the very bottom:
// Add a page for frames 0,1 p = app.documents[0].pages.add(); // Add and link frames bounds = allFrames[0].geometricBounds; nextFrame = p.textFrames.add({geometricBounds:bounds}); allFrames[0].
endTextFrame.
nextTextFrame = nextFrame; // This one. bounds = allFrames[1].geometricBounds; nextFrame = p.textFrames.add({geometricBounds:bounds}); allFrames[1].
endTextFrame
.nextTextFrame = nextFrame; // And this one. // Add a page for frames 2,3 p = app.documents[0].pages.add(); // Add and link frames bounds = allFrames[2].geometricBounds; nextFrame = p.textFrames.add({geometricBounds:bounds}); allFrames[2].
endTextFrame
.nextTextFrame = nextFrame; // And also this one. bounds = allFrames[3].geometricBounds; nextFrame = p.textFrames.add({geometricBounds:bounds}); allFrames[3].
endTextFrame
.nextTextFrame = nextFrame; // And that makes four.
With this alteration, the script is much more robust. It'll happily add more and more pages and frames at the end of your document, even if you are on the very first 4-column spread. You can run the script a dozen times and type away, until you need a dozen more pages.
Copy link to clipboard
Copied
Thanks IMMENSELY Jongware. Your help has been outstanding, I wish I could go back and assign your script the "correct" answer. One final Q, I assume this script will only work in CS4? There is a hurdle there for SP2 to be installed, which it isn't in my writing system. No hurdle in CS2.
Copy link to clipboard
Copied
Erm, I'm afraid you'll just have to try it and report any negative experiences. In general, the Javascript model has staid pretty much the same, but there have always been smaller and larger improvements, as well as the occasional re-working of an entire class of objects.
All-in-all it's a fairly basic script -- but, from memory, that handy property endTextFrame may not exist in CS2. Still, nothing to worry about, as there are several scripters with much more pre-CS3 experience than I have, and they'll sure chime in when necessary.
Copy link to clipboard
Copied
Nah, I think I will do what I have to to get CS4 in -- everyone says it is much better -- and now with your script, well, that's the biggest plus of all.
One final thing I forgot to mention, the 2 columns on the left page are different widths -- I presume ID can handle this? And the texts in each column have different font types and sizes to each other, however, in order to align the texts, I was planning on manually setting the same line height in all 4 columns. I presume ID can also handle this?
Copy link to clipboard
Copied
ID has no problem whatsoever with different column widths and font sizes. The Document Setup thingy will initially create guidelines for equal columns, but of course you are free to ignore them when drawing your own frames. If the predefined guides bother you, create your document with only one column.
The script is also not aware of column widths -- it simply copies the sizes of whatever four frames are on your current page (as long as they are high enough to be picked up by the script).
Copy link to clipboard
Copied
I imagine the leftmost frame can be made to include the gutter between its column and the next (ditto for the others).
Erm, no? Having a bit of trouble how you are visualizing this.
Use this to create a new document:
-- using your own document size and margins, of course. The default number of columns is 1, but you should change it to 2. Fill in a reasonable small value for the gutter, then hit "OK". InDesign will create a set of Master Pages for you, with all necessary guidelines, showing two columns separated by a bit o'gutter on the left hand page, and the same on the right hand page. You don't have to calculate any more allowance for the gutter.
The guidelines should be magnetic (if not, visit the View menu), making it easy for you to draw your four frames on the first set of pages.
Copy link to clipboard
Copied
Hi Jongware and / or Jay --
Unfortunately, I was not able to install CS4 because of the SP2 issue. But I have CS2 ID installed. I am battling a couple of things --
As you showed in your JPG picture, I set up a 2 column layout, but when I try to click on each column to adjust its properties, first I can't find properties for each column (not in right click). I managed to unlock the layout, and could slide the gutter around, but I can't specify column width exactly. Struggled with it for hours. So I dumped the column layout and drew two frames manually. They look different than columns, I can select one by one, and I can adjust the properties. But if I do 2 columns in each frame (I know someone said not to do that, because two columns in a frame will wrap left to right, and we don't want any left-right wraping at all) then I have both columns and frames!
Right now I am stumped as to whether I should be creating columns like you showed, or frames. If columns, I can't right click and individually select or change their properties -- e.g. I need to put in column block margins of 0.05" around each column for the text, and can't do that either. You will probably say -- read the manual. I have for hours and it still doesn't help until I get over this hurdle of frames or columns and how to adjust properties. The Text frame options seem totally independent of the column options -- adding even more confusion as to what I should be using and adjusting !!!
Also need to insert headers and footers, and don't know if they go outside the columns or part inside, or inside or outside frames !!! In Lotus WordPro, all of the above is done automatically for you, and you simply right click on each page element, and change its properties manually. It is SO easy!!
If you don't have time to help, maybe Jay might? Thanks guys. I am anxious to try out your script on CS2 to see if it works as intended, or if changes need to be made. So, whether to use frames of columns, and how to adjust properties on each, incl. header and footer, that is the battle I'm having.
Copy link to clipboard
Copied
Re. column guides: take a look at:
"Change page margin and column settings" here: http://help.adobe.com/en_US/InDesign/6.0/WS045460C6-5455-44d9-AB0A-3171FBD01A0F.html
(It's the same in CS2...)
Copy link to clipboard
Copied
Thanks Harbs, but I've already got the page margins and # of columns under control. It is the frame vs. column issue, both with separate settings, that is stumping me -- which to use, how to individually change properties of each.
Copy link to clipboard
Copied
The frames should be snapped to the margins. I don't understand your
problem.
Harbs
Copy link to clipboard
Copied
Jongware will probably have to respond to my long post, 4 above, as it relates to his script and his description of how to make columns, or alternatively frames.
Copy link to clipboard
Copied
Well, the script not only assumes separate frames per column, it totally depends on it. You can not use it with InDesign's columns. (Which are not what you need anyway, but let me stress that for clarity.)
1. Set up your main document. Don't specify any more than 1 column per page -- leave it at "1". Set up the margins as usual (treating both 'columns' you want as a unit).
2. On your master page, drag a vertical guide out of the left ruler and position it where you want to have the right edge of the left column. The left edge is defined by the regular left margin, so you don't need to do anything for that. Anyway, this is just a guide.
3. Drag another vertical guide and position it where you want the left of the rightmost column. Now you should have a blank master page, with a purple frame all around, and the cyan lines showing your own handmade 'column gutter'.
4. Place any repeating headers and footers on the master page as well (page numbering and such. See the manual for this sort of stuff -- it's really basic).
5. Now add 2 pages to your document so you have your first 2-page spread, on screen and visible, but still without any frames to put your text in. Let's fix that for the first spread.
6. With the Type tool, drag four separate frames, using the guides as, well, guides. It's easy, if you have "magnetic guides" set to On. Drag the frames as large as you need, but make sure you don't overlap them. Note that you don't have to allow for any "gutter" here; you should simply draw the frames as far apart as you need (you did put your vertical guides at the correct places, didn't you?).
7. With this first set of four frames, you can begin typing away. Run the script to add another set of two pages and create four new frames that get linked to the existing ones.
That is, if it works on CS2.
Copy link to clipboard
Copied
Jongware
I did everything you said and I indeed have a 2 page spread of 4 columns with separate texts in them. ID's terminology is weird, but these are actually "text frames". Now when I go to Text frame options, the correct width of each text column shows up and I can manually adjust it -- thanks!!
I presume the gutter settings on that text frame options dialog is irrelevant for 1 column per frame. Below it, it looks like the inset options is actually the text block options -- the distance to set the text in from the frame border. If so, I have all I need -- except for the first page -- dragging those guides from the margin presumably just set a snap position for the frames on pages 2 and 3 ? What more do I do with that page -- set the layout guides fixed?
The part I have not done yet is the header and footer. Every PAGE has a header and a footer, but Adobe in its infinite capacity to obfuscate the simple, only discusses TABLE headers and footers. Hell, I haven't even got any tables yet, and I don't see why I have to make tables just to get headers and footers on every page!! So if I have to add a table now, we have 3 divergent things superimosed on one page -- column guides, text frames and tables.
Philosophically, I can see that ID has been designed for micromanagement of flyers and brochures, where you want a whole raft of different elements all superimposed on the one page, to put complex layout with shading, table data, photos, and all kinds of mixed jazz all crowded into the one page space. Of course, this is counter the intent of book design, which is clean, simple, organized, and flows forever. I see ID will be a real battle to work with.
Anyway, after finally figuring out how to install a script, the first error I got was "We got lost somewhere ..." because the cursor was not focussed on a column text. When I clicked on a column text then ran the script, the error is -- "unable to find the 4 frames .... (0 found)". So it looks like CS2 will give you a bit of trouble. If needed, I can always be on the last page before I add any more linked pages. No problem, as I will be typing there anyway.
Thanks again for all your help.