4 Replies Latest reply on May 3, 2013 9:08 PM by STHLMscript

    Bring items in front of another

    STHLMscript

      The applescript dictionary for InDesign says:

      "bring to frontv : Brings the object to the front of its layer or in front of a particular item."

      But how do you write to bring the object in front of a particular item? The command only accept one parameter (the object that it brings to front).

        • 1. Re: Bring items in front of another
          Jump_Over Level 5

          Hi,

           

          this parameter is exactly what you need

           

          myObject.bringToFront(particularObject);

           

          Jarek

          1 person found this helpful
          • 2. Re: Bring items in front of another
            STHLMscript Level 1

            Thanks Jarek,

            you saved my day! Though I had to use the "do script"-command to make it work in Applescript:

             

             

            tell application "Adobe InDesign CS5"

                      set mySelectedPageItems to selection

                      set myObject to item 1 of mySelectedPageItems

                      set particularObject to item 4 of mySelectedPageItems

                      do script "arguments[0].bringToFront(arguments[1])" language javascript with arguments {myObject, particularObject}

            end tell


             

            I wasted so many hours yesterday trying to work it out in AS, but failed. Maybe someone know the right syntax in AS?

            • 3. Re: Bring items in front of another
              Jump_Over Level 5

              Hi,

               

              I would try:

              tell application "Adobe InDesign CS5"

                        set mySelectedPageItems to selection

                        set myObject to item 1 of mySelectedPageItems

                        set particularObject to item 4 of mySelectedPageItems

               

                      tell myObject

                             bring to front of particularObject

                        end tell

              end tell

               

               

              however can not test it

              Jarek

              • 4. Re: Bring items in front of another
                STHLMscript Level 1

                Tried it - and it didnt work! In this case the script will place the "particularObject" on top of every other object. I've also tried:

                set myObject to bring to front of particularObject

                ...with the same result. It's irritating. But anyway, with your help I found a way around the problem