4 Replies Latest reply on Feb 5, 2009 1:52 PM by (Mike_Nieuwstraten)

    [CS3 AS] New spread with 2 or more pages at front

      Anyone knows how to (Apple)script to get a new spread with 2 or more pages at before page 1?
      Just like what you would get when - in panel 'Pages' - you would drag a name of a masterpage (containing 2 or more pages) to the left of the first page (in the same panel) and the cursor is like a | (so not like a [ ).

      Otherwise, what is the syntax for:
      - making 2 or more new pages in one time based on a masterpage with the same number of pages?

      Thanks,
        • 1. Re: [CS3 AS] New spread with 2 or more pages at front
          sstanleyau Level 4
          tell application "Adobe InDesign CS3"<br />    tell document 1<br />        make spread at beginning with properties {applied master:master<br />spread 1}<br />    end tell<br />end tell<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
          • 2. Re: [CS3 AS] New spread with 2 or more pages at front
            Level 1
            Hi Shane (and others),

            Thanks for your response.
            I tried that with an existing document and that didn't work.
            Made a new document and it worked for a masterspread containing 2 pages.

            After investigating, the difference was that the new document had 'Facing pages' activated in document prefs.
            So I turned that option on in the existing document: now it works as long there are only 2 pages in the masterspread.

            'Unfortunately' I need it to work for 3 pages per spread.
            I tried fooling around with

            tell document preferences
            set allow page shuffle to false --or true
            set preserve layout when shuffling to true --or false
            end tell

            but made no difference.
            Anyone any idea?
            • 3. Re: [CS3 AS] New spread with 2 or more pages at front
              sstanleyau Level 4
              Have you tried making a spread and then making extra pages at the end of the<br />spread?<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Florida, April 2009 <a href=http://scriptingmatters.com/aspro>
              • 4. Re: [CS3 AS] New spread with 2 or more pages at front
                Level 1
                Shane,

                'make at end' didn't work either. The only way I got them in was to 'move to end of spread'.
                To tackle all parameters I ended up with:

                tell application "Adobe InDesign CS4"
                tell document 1
                tell document preferences
                set preserve layout when shuffling to true --not shure if needed
                set PagsInNieuweSpread to 1
                if facing pages is true then set PagsInNieuweSpread to 2
                end tell
                set DeMasterNamen to name of every master spread
                if (count of items of DeMasterNamen) is 1 then
                set TeGebruikenMasterNaam to (item 1 of DeMasterNamen)
                else
                set TeGebruikenMasterNaam to item 1 of (choose from list DeMasterNamen)
                end if
                set PagsPerMaster to (count pages of master spread TeGebruikenMasterNaam)
                set NieuweSpread to (make spread at beginning with properties {applied master:master spread TeGebruikenMasterNaam})
                if PagsPerMaster > PagsInNieuweSpread then
                repeat (PagsPerMaster - PagsInNieuweSpread) times
                set NieuwePag to (make page at end of NieuweSpread)
                move NieuwePag to end of NieuweSpread
                end repeat
                end if
                end tell
                end tell

                OK, some dutch for the variables, but you get the idea...
                Thanks for leading me to this final solution!

                Michiel