5 Replies Latest reply on Oct 11, 2017 5:10 AM by beto correa

    Move selected object to layer shortcut

    lewis_cooper Level 1

      Hi everyone,


      I'd like to be able to invoke a script that would simply shift the selected object (text frame or picture frame) to another layer without me having to open the layers panel, select the tiny dot and drag to another layer. I find this fiddly and awkward especially on repetition.


      I previously asked people here how I could run a script that looked for objects with an assigned attribute and retrospectively move them all to one layer. But I'd prefer to be able to hit a command with the object selected that pushed the object on to a specific layer.


      To me, this really should be an inbuilt shortcut, such as command-alt-up/down arrow. As far as I can tell this isn't assigned to anything and would come in really handy!


      Can anyone suggest a solution for this, script or otherwise?


      Many thanks!


        • 1. Re: Move selected object to layer shortcut
          [Jongware] Most Valuable Participant

          How about this Dynamic Duo?


          //DESCRIPTION: One Layer Down
          for (s=0; s<app.selection.length; s++)
           if (app.selection[s].itemLayer.index < app.activeDocument.layers.length-1)
            app.selection[s].itemLayer = app.activeDocument.layers.nextItem(app.selection[s].itemLayer);


          //DESCRIPTION: One Layer Up
          for (s=0; s<app.selection.length; s++)
          if (app.selection[s].itemLayer.index > 0)
            app.selection[s].itemLayer = app.activeDocument.layers.previousItem(app.selection[s].itemLayer);


          It works, even with a multiple selection on different layers.


          Be warned that without the Layer panel open, you might not be aware of your current active layer! This changes as a selection is moved from one layer to another.

          • 2. Re: Move selected object to layer shortcut
            lewis_cooper Level 1

            Thanks very much Jongware,


            I'll try this out and see how it goes. Do you know if its possible to tweak this so that it allow moving to a locked layer? The same way that holding the command key allows when dragging between layers? That way I could keep my destination layer (and any others) locked so as to isolate myself to one layer, the only unlocked one?


            Could be a solution to pitfall you mention if it can be done...




            • 3. Re: Move selected object to layer shortcut

              no way to beat [Jongware]

              this toggles thru all layers.




              Message was edited by: liedzeit


              I give up. Cannot insert code...

              • 4. Re: Move selected object to layer shortcut
                lewis_cooper Level 1

                Thanks for your advice on this, it works a treat. In fact it actually allows you to move the object over to a locked layer (although not back out again).


                I have the two scripts assigned to command-alt-up and command-alt-down and this will speed up my workflow immensely.


                Thanks again.


                • 5. Re: Move selected object to layer shortcut
                  beto correa Level 1



                  I need to move an paragraph style to a layer. (Indesign CS6)


                  I found it an apple script (CS4):


                    set myPstyle to paragraph style "CODES"

                             -- if the page is a spread

                             set x to properties of spread 1


                             set LayerName to "PR"


                                 set myLayer to layer LayerName

                                 set the properties of myLayer to {locked:false}

                             on error


                  Is it possible in java script (or apple script CS6) that I can to build a list of styles moving to a 2 different layers all at once and every page?