• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

JS script to continue parallel column layout to new pages

New Here ,
Mar 04, 2010 Mar 04, 2010

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?

TOPICS
Scripting

Views

5.6K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Mar 06, 2010 Mar 06, 2010

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

...

Votes

Translate

Translate
Community Expert ,
Mar 10, 2010 Mar 10, 2010

Copy link to clipboard

Copied

Yaahhh ... you'd might benefit of one of the Lynda.com's courses at this point. Sure, what Adobe describes for tables are called "headers and footers". That's because that's a special case. Regular, everyday, headers and footers ... you have to draw yourself. That's what the master pages also are for (including such niceties as automatic page numbering and automatically picking up text from your running text to put in the header and/or footer).

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.

Perhaps the script doesn't work at all, but so far it sounds like you didn't adjust the script to look only for frames that match the height of the ones you are using. (Remember, the line where I said to "remember to change this value"?)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2010 Mar 10, 2010

Copy link to clipboard

Copied

Duuhh !!!  Thanks for the reminder !!  Battling some big problems in ID, I totally forgot about that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 14, 2010 Mar 14, 2010

Copy link to clipboard

Copied

Jongware --

It would appear that your script DOES work in CS2.  Congratulations.  However, I am having trouble undertanding why an inequality relates to an equality

if (allFrames.geometricBounds[2] - allFrames.geometricBounds[0] < 180)
          allFrames.splice(a,1);

This says that if total height of the frames is LESS THAN 180 mm -- then do the frame splicing.

In my case, I used inches.  The page height is 11 inches.  But with 0.5 inch margins top and bottom, the frame height is 10 inches.

I tried the value in your equality of 11 inches -- and it should have worked, because 10 inches is less than 11 inches.  But it did not.

I tried values less than 10 inches (as well as greater than), and it still did not work.  Only when I used exactly 10 inches did it work.

In what kind of multi-dimensional warped-space-time universe does an INequality exactly equal (i.e. equate to) an Equality ??????

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2010 Apr 01, 2010

Copy link to clipboard

Copied

@Jongware,

recently I tested your script on a document. At first run it behaved a little strange, until I realized that the ruler origin of my document was set to PAGE_ORIGIN. Of course, that will mess up the geometricBounds calculations.
So I suggest a few lines of code at the beginning to set the ruler origin to SPREAD_ORIGIN:

var d=app.activeDocument;
var rulerOriginOLD = d.viewPreferences.rulerOrigin;
d.viewPreferences.rulerOrigin = RulerOrigin.SPREAD_ORIGIN;

and at the end of the script set them back to what they were:

d.viewPreferences.rulerOrigin = rulerOriginOLD;

By the way, there is an interesting thread going on about "synoptic typesetting" at the Swiss/German forum "hilfdirselbst". See yourself in its InDesign forum at:
http://www.hilfdirselbst.ch/gforum/gforum.cgi?post=438273#438273

Gerald Singelmann wrote a script solution, a proof of concept he states, for synchronizing two text flows on paragraph level.

Uwe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2010 Apr 01, 2010

Copy link to clipboard

Copied

Ah, Gerald beat me to it -- I ran a few tests for that as well. It's really easy with only short paragraphs, but with longer ones, as soon as things get out of whack it's very hard to restore ...

And then the OP that started your thread wants to insert pictures in either column as well. Good luck with that

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 01, 2010 Apr 01, 2010

Copy link to clipboard

Copied

No comment on my question above?  Your code shows an inequality for the line length and I am having trouble seeing why it is an equality.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 01, 2010 Apr 01, 2010

Copy link to clipboard

Copied

I read it but thought, "Boy I hope someone else comes up with an explanation soon".

Only thing I can think of is that InDesign doesn't really work in inches -- nor in millimeters, for that matter. Internally, everything is converted to points.

Now usually I would put something like this off to rounding -- because you cannot express a millimeter value exactly in points --, expect that ID uses an exact conversion from inches to points ... (as in: 72 pts per inch -- simple as that.)

And that does not address why (.. < 11) (inch) does not match for a value of "10". That's a contradiction in expectation.

It's possible to set your zero point to halfway the page, but even then the math's hold: top_y is "-5in", bottom_y is "5in", difference is bottom_y minus top_y, so 5 minus -5 which still equals 10, which is (in my experience, up until now) less than 11 ...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Apr 06, 2010 Apr 06, 2010

Copy link to clipboard

Copied

LATEST

I also have no idea why your code would not have worked.

Maybe post your code and it'll give us a clue?

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 06, 2010 Mar 06, 2010

Copy link to clipboard

Copied

ScratchyBoy wrote:

Too bad.  APID is?

http://www.rorohiko.com/wordpress/indesign-downloads/active-page-item-developer/

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 07, 2010 Mar 07, 2010

Copy link to clipboard

Copied

Not sure if it is an option for you to switch from InDesign to FrameMaker, but continuing a parallel column layout to new pages is quite simple using Adobe FrameMaker -- no scripting involved. FrameMaker solves the problem by letting you assign different "Text Flow" labels to the left and right pages -- you can even have more than one flow on the same page. For example, I used this technique to create a book with German language on the left-hand pages and English language on the right-hand pages. It was super easy with FrameMaker to keep the German and English flows separate.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2010 Mar 07, 2010

Copy link to clipboard

Copied

Jay, this is why I am asking on this forum -- I have not picked anything in particular yet -- so yes, I could use framemaker, if it is still available.

Remember, it is 2 columns on the left even pages and 2 on the right -- and they all have different texts.  If I set up 4 vertical frames, will they all stay in their correct relative positions throughout the book (i.e. left 2 on left pages, right 2 on right pages)?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2010 Mar 07, 2010

Copy link to clipboard

Copied

Jay --

Good God man !!  Adobe wants $1000 for Framemaker.  They say it has "improved" support for book publishing.  "Improved" does not always mean better though.  What version framemaker did you use, and do you still have it?  I understand it is not really a DTP, but a frame-based word processor ?  Either way, there is no way I would throw a grand at it, that is for sure.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Mar 07, 2010 Mar 07, 2010

Copy link to clipboard

Copied

I have FrameMaker version 8 (version 9 is the current version), and have been using it since version 4. I can understand that you woudn't spend $1000 on it -- if you work for a company that would buy it for you, of course, that's different. FrameMaker is a page layout program, but a very specialized one designed for long technical documents, such as user guides. I also use InDesign. I love both of these programs -- two different programs with different target markets.

Sounds like Jongware has created an excellent script that will solve the page flow issue for you, so I agree, might as well use InDesign. Jongware is a treasure -- a talented scripter, likes a challenge and is always ready to help. I am grateful for his help more than once in the past.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 07, 2010 Mar 07, 2010

Copy link to clipboard

Copied

Yep -- that he has.  So it is off into the Indesign world, thanks to Jongware.

If you guys stay attached, I will post an update in proably 3-4 days.

Thanks again for a super script Jongware, looks like it does all I need.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines