Skip navigation
Currently Being Moderated

Importing MS docs to odd pages only

Aug 9, 2012 6:02 PM

About a year ago I got some help from John Hawkinson (thanks again!) with a script to import word documents to multiple pages with the same master page. That discussion can be found here: http://forums.adobe.com/message/3732719#3732719

I would now like to modify this script to apply it only to the one side of a series of two page spreads using the same master page spread. In other words, let's say I have 300 facing pages that use A-Master. I would like to import 150 pages into the odd (right hand side) pages of the spread (page 1.doc gets imported to page 1, page2.doc gets imported to page 3, page 3.doc gets imported to page 5, etc.).

 

Is there any easy way to do this?

 

Thanks,

Neil

 
Replies
  • Currently Being Moderated
    Aug 10, 2012 1:23 AM   in reply to Neil Weinberg

    Neil Weinberg wrote:

     

    Is there any easy way to do this?

     

    At a glance,

     

    for (i=0; i<p.length; i+=2)
    

     

    ought to work.

     

    [Edit] Gah! There is color, bold, and underlining to mark my change -- but this **** *** forum software does not show it!

     

    The minor change is 'i++' to 'i+=2'. Given some time, I can explain why.)

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 10:36 AM   in reply to Neil Weinberg

    > I think I would need separate counters--one for the word doc numbers and another god the INDD page where it is imported.

     

    Oui mon frère, I was overseeing the "page number" thingy was re-used in John's script to select a numbered Word file.

     

    Quick-and-ever-so-slightly-dirty: re-use the loop (page) counter but divide it by two! (.. and add 1 because loops run from zero upwards).

     

    frames.textFrames[2].place(new File("/path/to/page"+String((i>>1)+1)+".doc"));

     

    I prefer to use the >> operator here, rather than division, because Javascript is scrupulous about its divisions and dividing an odd number such as '3' by 2 will result in 1.5. Logical, but nasty. Bit shifting the value 3 to the right ibehaves like "divide, round down" -- the lowest bit just gets lost.

     

    Fortunately, you don't have odd numbers in your loop *here* but hey, you might want to repurpose this script for odd numbered pages!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points