6 Replies Latest reply on Jun 24, 2010 8:03 AM by Rastakaya

    [AS CS3] make new section?

      for starters, I get no results for any searches of the forum. so hopefully, this topic isn't a repeat.

      I just upgraded from CS1 and I'm making some transitions. everything has been fairly straightforward, but I can't seem to get this section start to work:

      tell myDoc
      set thisSection to make new section with properties ¬
      {page start:thisPage, page number start:pgNumber, name:sectName,¬
      page number style:numStyle, continue numbering:false, ¬
      marker:sectMarker, include section prefix:showPrefix}¬
      end tell

      all of the variables have been picked up from existing info in the doc, and there don't seem to be any problems there. it's making the section that stops it. here's the error message:

      “Adobe InDesign CS3 got an error: Can't make class section.”

      just for kicks, I tried taking out the props and just making a section, but I got the same error. thoughts?
        • 1. Re: [AS CS3] make new section?
          Level 1
          btw, I did try script versioning for that section of the script to no avail. it worked in CS1, but it's not making it through the versioning translation.
          • 2. Re: [AS CS3] make new section?
            Kasyan Servetsky Level 5
            Hi plain*clothes,

            This works in CS3 - in a blank 5 pages document:
            --------------------------------------
            tell application "Adobe InDesign CS3"
            set myDoc to active document
            tell myDoc
            set thisPage to page 3
            set thisSection to make new section with properties¬
            {page start:thisPage, page number start:2, name:"Prefix",¬
            page number style:arabic, continue numbering:false,¬
            marker:"Kas", include section prefix:false}
            end tell
            end tell
            --------------------------------------
            Check the variables that you use inside the tell myDoc block.

            Kasyan
            • 3. Re: [AS CS3] make new section?
              Level 1
              thanks for checking Kasyan. I just found pretty much the same thing in another document. my problem seems to be on the doc I started my testing with: a section start for each page of each spread (44a-1a, 44b-1b, etc). I'd forgotten that this had posed a problem for me at one point with CS1 and I solved it. I guess I need to find the work around in CS3 now. I check back when I have something... hopefully soon!
              • 4. Re: [AS CS3] make new section?
                Level 1
                -- scratch that ... I'll post an update shortly. --
                • 5. Re: [AS CS3] make new section?
                  Level 1
                  okay, now I'm up to speed. CS1 apparently allowed me to "make section" over the top of an existing section. CS3 is not so soft. that very helpful "can't make class selection" error message was trying to tell me that there was already a section start in place and if I wanted to make changes I needed to access the "applied section properties".

                  I don't need to change existing sections, I'm just making the spreads movable without losing page numbers (don't ask). my solution was to run through and compare the section start to the page itself. if they matched, the script just moves on and doesn't worry about creating a start. here's the code, if anyone's interested. feel free to critique my methods.

                  (* begin script *)

                  set thisSpread to object reference of spread i of myDoc
                  set thePages to object reference of every page of thisSpread
                  set thisPage to object reference of page 1 of thisSpread
                  set thisSect to applied section of thisPage
                  set sectStart to page start of thisSect

                  -- if there's already a section start, then don't worry about it
                  if sectStart is not thisPage then
                  -- gather the necessary info
                  end if

                  -- does the second page of a spread need/have a start
                  if number of items in thePages is not 1 then
                  set nextPage to object reference of page 2 of thisSpread
                  set nextSect to applied section of nextPage
                  set nextStart to page start of nextSect
                  if nextSect is not equal to thisSect then
                  if nextStart is not nextPage then
                  -- gather info
                  end if
                  end if
                  end if

                  -- check the findings above and apply sections if needed

                  if sectStart is not thisPage then
                  set thisSection to make section with properties {page start:thisPage, page number start:pgNumber, name:sectName, page number style:numStyle, continue numbering:false, marker:sectMarker, include section prefix:showPrefix}
                  end if

                  if (count of pages) is greater than 2 then
                  if nextSect is not equal to thisSect then
                  if nextStart is not nextPage then
                  set nextSection to make section with properties {page start:nextPage, page number start:nxtPgNumber, name:nxtSectName, page number style:nxtNumStyle, continue numbering:false, marker:nxtSectMarker, include section prefix:nxtShowPrefix}
                  end if
                  end if
                  end if

                  (* end script *)

                  ps: why can't we use the 'code' tag to make this stuff look right? am I missing something.
                  • 6. Re: [AS CS3] make new section?
                    Rastakaya

                    This worked for me, although I'm not sure it will work in all situations. Just thought I'd throw in my script as another option.

                     

                     

                    global fileList
                    global pageCount
                    set pageCount to 1

                     

                    tell application "Adobe InDesign CS3"
                        set myDoc to active document
                        tell myDoc
                            set docPrefs to properties of document preferences
                            set numPages to pages per document of docPrefs
                            repeat with p from 1 to numPages
                                set thisPage to page p
                                set thisSection to make new section with properties ¬
                                    {page start:thisPage, page number start:p, name:"Prefix", page number style:arabic, continue numbering:false, include section prefix:false}
                            end repeat
                        end tell
                    end tell