6 Replies Latest reply on May 8, 2009 11:32 AM by wreyfmonkey

    Change Stroke Color on a Row in a Table

    wreyfmonkey

      Greetings,

       

      I am trying to set the stroke color of a row to the swatch in my palette named "[None]".  My script runs and, interestingly enough, does not error...but it also does not change the stroke either.  Here is my script:

       

      tell application "Adobe InDesign CS3"

      set properties of row 1 of table 1 of page item "Box" of document 1 to {stroke color:"[None]"}

       

      end tell

       

      So in theory, when this script is done, my row should appear to have no black outlined cells.  What am I missing or otherwise doing wrong here?  Thanks in advance for the help!

        • 1. Re: Change Stroke Color on a Row in a Table
          Olav Martin Kvern Level 3

          Hi wreyfmonkey,

           

          It's a matter of context. The stroke color "[None]" can belong to either the application (where it's an application default) or the document. You want the one that belongs to the document. So...

           

          set properties of row 1 of table 1 of page item "Box" of document 1 to {stroke color:"[None]" of document 1}

           

          Thanks,

           

          Ole

          • 2. Re: Change Stroke Color on a Row in a Table
            wreyfmonkey Level 1

            Hi Olav,

             

            Much thanks for the reply!  The syntax you sent wouldn't compile, but I moved the squiggly bracket after the swatch name (like this: {stroke color:"[None]"} of document 1) and it did compile.  But for whatever reason, the stroke is still not changing and the script still does not error.  So after your help, I have the following script, but it still doesn't change the stroke...

             

            tell application "Adobe InDesign CS3"

            set properties of row 1 of table 1 of page item "Box" of document 1 to {stroke color:"[None]"} of document 1

            end tell

             

            Any other ideas?  I know this discussion can be "answered" with just a little help!

            • 3. Re: Change Stroke Color on a Row in a Table
              Olav Martin Kvern Level 3

              Hi wreyfmonkey,

               

              Sorry about that, I typed the response off the top of my head and didn't test it. There are more problems with your script than just the first one I saw. Try something like this:

               

              tell application "Adobe InDesign CS4"

                   tell document 1

                        set mySwatch to swatch 1

                        set myTextFrame to item 1 of text frame "Box"

                        set myTable to table 1 of text 1 of myTextFrame

                        set top edge stroke color of row 1 of myTable to mySwatch

                   end tell

              end tell

               

              Thanks,

               

              Ole

              • 4. Re: Change Stroke Color on a Row in a Table
                wreyfmonkey Level 1

                Thanks again, Ole, but that is still not working for me.  Just to make sure I am describing it correctly, let me tell you how I would do this without a script.

                 

                Using the text tool in InDesign CS3, I select the entire row and with that row selected, I go to my swatches palette and set the stroke to [None]...the white box with the thin red diagonal line through it.  When I do it by hand, it works but when I try to run my script or yours, it doesn't do anything.  Previously, I had also tried adjusting the top, bottom, left and right stroke colors but none of that has worked so far.  I even ran a script to get the properties of the selected row after I fixed it by hand and then tried applying those properties with a script, but to no avail.

                 

                Visually, the results should look like the attached photos.  Picture 2 is the "before" and picture 3 is the "after".

                 

                I know we can figure this out!

                • 5. Re: Change Stroke Color on a Row in a Table
                  Olav Martin Kvern Level 3

                  Hi wreyfmonkey,

                   

                  Here's a script that sets everything up for you and then formats the table:

                   

                   

                  tell application "Adobe InDesign CS4"

                  --Make a new document and set up an example text frame.

                  tell (make document)

                  set horizontal measurement units of view preferences to points

                  set vertical measurement units of view preferences to points

                  tell page 1

                  make text frame with properties {geometric bounds:{72, 72, 144, 288}, label:"Box"}

                  end tell

                  set myTextFrame to item 1 of text frame "Box"

                  tell insertion point 1 of myTextFrame

                  make table

                  end tell

                  --Now we have a text frame with the script label "Box"

                  --that contains a table.

                  --Here's where your script would come in:

                  set mySwatch to swatch "None"

                  --Get a reference to the table.

                  set myTable to table 1 of text 1 of myTextFrame

                  --inner column stroke color will apply to all of the

                  --left/right cell borders in the row.

                  set inner column stroke color of row 1 of myTable to mySwatch

                  --Just to be sure, let's set the stroke weight to 0.

                  set inner column stroke weight of row 1 of myTable to 0

                  --You can experiment with "left edge stroke color",

                  --"right edge stroke color", etc., until you get

                  --the formatting you want. The point is to

                  --address the relevant property of the row.

                  end tell

                  end tell

                   

                  Thanks,

                   

                  Ole

                  • 6. Re: Change Stroke Color on a Row in a Table
                    wreyfmonkey Level 1

                    Ole,

                     

                    Thank you so much for taking the time to type that out, man.  Sure enough, I found my answer in your script and here it is:

                     

                    set inner column stroke color of row 1 of table 1 of page item "Box" of document 1 to "None"

                     

                    So "inner column stroke color" was the property I kept missing.  You are a champ! THANKS!