4 Replies Latest reply on Aug 4, 2009 4:16 AM by lewis_cooper

    Move selected object to layer shortcut

    lewis_cooper

      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!

      Lewis

        • 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...

             

            Cheers,

            Lewis

            • 3. Re: Move selected object to layer shortcut
              liedzeit Level 2

              no way to beat [Jongware]

              this toggles thru all layers.

              Ralf


               

               

              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.

                Lewis