5 Replies Latest reply on Jan 16, 2012 11:13 AM by Gonterman1201

    [AS][CS5]Use of Scripting Label no longer working from CS4 script

    lithodora

      We recently upgraded from CS4 to CS5.5. A good majority of my scripts no longer work.

       

      tell application "Adobe InDesign CS4"

        set contents of text frame "expdate" of page 1 of document 1 to "Works"

      end tell

       

      tell application "Adobe InDesign CS5.5" to

        set contents of text frame "expdate" of page 1 of document 1 to "Does not work"

      end tell

       

      There is a text frame with the script label of 'expdate'. I created the same document in CS4 & CS5.5.

      The above script works in CS4. It does not in CS5.5.

      I can't seem to find it in the guide what I am to change to.

       

      Any help on this?

        • 1. Re: [AS][CS5]Use of Scripting Label no longer working from CS4 script
          [Jongware] Most Valuable Participant

          With CS5, some things have changed: http://forums.adobe.com/thread/615381

           

          Scroll down to read Shane Stanley's AS solution, or read the entire thread for a more complete understanding.

          • 2. Re: [AS][CS5]Use of Scripting Label no longer working from CS4 script
            lithodora Level 1

            I had seen that thread and I had tried using the method but got an error response.

             

             

            [Shane Stanley] wrote:

            Yes. To refer by item, you should use something like:

             

            item 1 of all page items whose label is "whatever"

             

            Instead of 'rectangle "photo1"', you need to use 'rectangle 1 whose label is "photo1"'.

            I tried to use:

             

            tell application "Adobe InDesign CS5.5"

              set myframe to item 1 of all page items of page 1 of active document whose label is "expdate"

                      set contents of myframe to "does not work"

            end tell

             

            Error is variable myframe is not defined.

             

            Then I tried

             

            tell application "Adobe InDesign CS5.5"

              set contents of item 1 of all page items of page 1 of active document whose label is "expdate" to "does not work"

            end tell

             

            that seems to work, but I have documents that have multiple items with the label. So, I'll make some sort of repeat to deal with that....

             

            Just an odd way of having to do it.


            • 3. Re: [AS][CS5]Use of Scripting Label no longer working from CS4 script
              sstanleyau Level 4

              I tried to use:

               

              tell application "Adobe InDesign CS5.5"

                set myframe to item 1 of all page items of page 1 of active document whose label is "expdate"

                        set contents of myframe to "does not work"

              end tell

               

              Error is variable myframe is not defined.

               

              I'm a bit surprised -- your snippet works as expected here.

              • 4. Re: [AS][CS5]Use of Scripting Label no longer working from CS4 script
                lithodora Level 1

                Well I rebooted the computer and used that snippet again and it worked as I expected it to. Odd.

                 

                Here's what I ended up doing:

                 

                --CS5 Way

                  repeat with z from 1 to count of (every page item of page 1 of active document whose label is "expdate")

                  set myframe to (item z of all page items of page 1 of active document whose label is "expdate")

                  set contents of myframe to expdate

                  end repeat

                  --set contents of text frame "expdate" of page 1 of document 1 to expdate --CS4 Way

                 

                It seems that what I was doing before only worked because CS4 would change every text frame whose label is "expdate" in one command.

                The CS5 method isn't that much different other than I must define which of the items to change.

                 

                Is there a better way of going about this then?

                 

                Thanks

                 

                Message was edited by: lithodora

                • 5. Re: [AS][CS5]Use of Scripting Label no longer working from CS4 script
                  Gonterman1201 Level 1

                  Why not just version the script so it runs on 4? app.scriptPreferences.version = 6.0;