2 Replies Latest reply on Jul 13, 2016 4:34 AM by Loic.Aigon

    Apple or javaScript to make multiple pages

    paturner7

      Hi guys,

       

      I have an apple script someone made for InDesign CS6 and i am trying to use it in InDesign CC. Unfortunately its not working. Can anyone tell me how to manipulate this script to get it to work in CC?

       

      See script:

       

      on open theFolder

       

      display dialog "How many *Pages* in the catalog?" default answer "" buttons {"Create Spreads", "Cancel"} default button 1

       

        copy the result as list to {theButton, theNumber}

       

        if theNumber is "" then

        set theNumber to "force an error" --making the number this string will force an error in the next step

        end if

       

       

       

        try

        set theNumberInt to theNumber as integer --will error if the number of pages entered is a blank or some text and go to the on error section

        set divisor to (theNumberInt mod 2) - 1

        set test to 100 / divisor --will error if the number of pages entered is not an even number end go to the on error section

       

       

       

       

        tell application "Finder" to set FileList to get every item of (entire contents of folder theFolder) whose kind is "InDesign® CS6 Document"

        set divisor2 to count of items of FileList

       

       

        if divisor2 is not 1 then --if there's more than 1 indd v6 document in the folder, this will force an error

        set divisor2 to 0

       

        end if

        try

        set test2 to 100 / divisor2 --ok there's one and only one indd v6 file in the folder, keep going...

        set fileName to name of item 1 of FileList as text

       

        set i to 0

        repeat with i from 1 to (theNumberInt / 2) - 1

        set fileName to name of item 1 of FileList as text

        set Spot to offset of "002" in fileName

        set divisor3 to 100 / Spot

        set nameStart to text 1 thru (Spot - 1) of fileName

        set namePage to "00" & (2 * i) + 2 as text

        set namePage to characters -1 thru -3 of namePage as text

        set theFile to duplicate item 1 of FileList

        set name of theFile to nameStart & namePage & "A0.indd" as text

        end repeat

        on error

        display dialog "The folder needs to contain a single InDesign version 6 document of page 002." buttons {"OK"} default button 1

        end try

       

       

       

       

       

        on error

        display dialog "Please enter an even number." buttons {"OK"} default button 1

        end try

       

       

       

      end open