9 Replies Latest reply on Aug 25, 2008 5:03 AM by (kevin_quinn)

    Applescript create document with columns

      Hi all,

      I do hope someone can help with this. I'm trying to applescript the creation of cover and dust jacket files for a book publisher. I can create the document ok, and then create guides with a gutter for the spine width. However, in order to place other guides on the spread (such as the point where the dust jacket flap folds over the egde of the book, I need to create more guides (again 2 column) with a much larger gutter; in one case 512mm. However, I keep getting an error message that the gutter can't be greater than 508mm! And this is regardless of document width.

      Any ideas?

      Cheers,

      Kev.
        • 1. Re: Applescript create document with columns
          Level 1
          Oh, btw, I[m using ID CS2
          • 2. Re: Applescript create document with columns
            [Jongware] Most Valuable Participant
            Using columns to mimick the spine is a manual UI trick -- it ensures the 'spine' (the column gutter) always automatically comes in the middle. But scripting it is a good idea, so why not place 'regular' guides instead? You can calculate the positions just as ID does for columns.

            Apart from that, I'm having a bit of mental trouble trying to visualize what your document is supposed to look like.

            (Cheesy ASCII art follows)

            [-----||-----]
            
            [- B -||- F -]
            [-----||-----]
            [-----||-----]

            Imagine this is your cover; its page size is 2 x page width + spine width. Now, in the UI, all you have to do is set the margins to 0 and set the number of columns to 2, with a gutter of (spine width).
            How would you create more(?) columns, with other(??) gutter widths, for the dust jacket?

            Given the width of the dust flap, page width, and spine, you can draw all guides needed immediately at the right positions.
            • 3. Re: Applescript create document with columns
              Level 1
              Hi, Thanks for getting back to me. I don't quite understand your terms ('regular' guides, 'manual UI'). However, I can create guides easily enough:<br /><br />set myGuide to make guide with properties {orientation:vertical, location:90}<br />set myGuide to make guide with properties {orientation:vertical, location:93}<br />set myGuide to make guide with properties {orientation:vertical, location:96}<br /><br />but creating columns and setting gutter width seemed to be a simple way of creating two guides at the same time, working out from the centre spine, rather than individually. I just read in the Scripting guide that gutters are limited to 1440 points, but wondered why. The doc I'm creating is like this:<br /><br />|<flap>||<back panel>||<spine>||<front panel>||<flap>|<br /><br /> being a few mm for wrapping around the cover.<br /><br />Cheers again.<br /><br />kev.
              • 4. Re: Applescript create document with columns
                [Jongware] Most Valuable Participant
                A regular guide (in this context) is just one you draw manually, rather than the automatic ones that are created by the Columns function. The UI is the User Interface (the screen you normally work with, doing things manually).

                >creating columns and setting gutter width seemed to be a simple way of creating two guides at the same time, working out from the centre spine, rather than individually

                Yeah, that's the 'manual' trick, so you don't have to do the calculations. However, you can only create a normal cover with it -- no dust jackets -- because you can only create columns of the same width, with the same gutter width. So it works for 3 parts (2 columns + spine) but not for (..counting) 9 parts in 5 different widths.

                So go for using guides.

                >I just read in the Scripting guide that gutters are limited to 1440 points, but wondered why.

                The programmers must have thought 20 inch would be enough gutter for everyone :-) [*] Remember, this is designed to be
                i space inbetween columns,
                rather than being (ab)used for cross-purposes. As to why there is a built-in limit at all, and why this much (2" already is more than I've ever used), well, who knows.

                [*] "640K ought to be enough for anybody." - Bill Gates, 1981
                • 5. Re: Applescript create document with columns
                  Level 1
                  :)

                  Thanks for clearing that up. I'm working around the problem ok anyway now ... except for one thing. Why do these work:

                  set left of margin preferences of every page of mydoc to "10"
                  set right of margin preferences of every page of mydoc to "10"
                  set bottom of margin preferences of every page of mydoc to "10"

                  but this:

                  set top of margin preferences of every page of mydoc to "10"

                  returns an error:

                  "A application constant or consideration can't go after this application constant or consideration."

                  Cheers,

                  Kev.
                  • 6. Re: Applescript create document with columns
                    [Jongware] Most Valuable Participant
                    From here on I'll leave it to the AppleScript scripters...

                    In JavaScript it is marginPreferences.top, just as you'd expect. Perhaps "top" is a reserved AS word??? (now I'm guessing blindly). You spelled it okay.
                    • 7. Re: Applescript create document with columns
                      Level 1
                      Hi jongware, thanks again. 'top' shouldn't be a reserved AS word, it's referenced in the Indesign AS library:

                      margin preference n : Margin preferences
                      properties
                      bottom (number or string) : Bottom edge of the margin preference
                      class (type class, r/o) : The class descriptor type
                      column count (integer) : The number of columns
                      column gutter (number or string) : The distance between columns in a text frame
                      columns positions (list of number or string) : Columns positions
                      custom columns (boolean, r/o) : Has custom columns
                      left (number or string) : Left edge of the margin preference
                      object reference (margin preference, r/o) : An object reference for this margin preference
                      parent (reference, r/o) : The margin preference's parent. Can return: application, document or page.
                      properties (record) : Property that allows setting of several properties at the same time
                      right (number or string) : Right edge of the margin preference
                      top (number or string) : Top edge of the margin preference

                      Oh well, I'll keep on looking.

                      Thanks again,

                      Cheers,

                      kev.
                      • 8. Re: Applescript create document with columns
                        sstanleyau Level 4
                        The problem is a conflict with another InDesign enumeration, "top of<br />margin", used for baseline frame grid options. The workaround is braces:<br /><br />set top of (margin preferences) of every page of mydoc to "10"<br /><br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
                        • 9. Re: Applescript create document with columns
                          Level 1
                          Hiya Shane,

                          That's excellent, thanks.

                          Cheers,

                          kev.