Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Script to move images to seperate layer

Return to Member Forum

  • Author
    Posts
    • #111827

      Hi all.

      Does anyone have a script that would move all images(in their frames) in a document, to a layer named Images?

      Or Help me with the obviously wrong script here.

      I’m trying to select all graphics. Or is it all graphic frames. I have no hair left!

      Ideas appreciated

      L = app.activeDocument.layers.item (‘Images’);
      app.activeDocument.allGraphics.everyItem().itemLayer = L;

    • #112836

      William,

      Alas, I can’t answer you! …

      Michel, for FRIdNGE
      michel.allio.fridnge@gmail.com

    • #112973

      Hi William

      You must move the parent of the graphic and not the graphic itself. The parent is the frame containing the graphic.
      And then I believe you need to loop through each of them to do so. (Maybe there is a smarter way than looping.)

      var theDoc = app.activeDocument;
      var theGraphics = theDoc.allGraphics;

      if(!theDoc.layers.item (“images”).isValid){
      var imgLayer = theDoc.layers.add({name:”images”}); //adding layer if it is not present
      }
      else {
      var imgLayer = theDoc.layers.item(“images”);
      }

      for (var i = 0; i < theGraphics.length; i++) {
      theGraphics[i].parent.itemLayer = imgLayer;
      }

    • #113557
      Masood Ahmad
      Participant

      Hi William,

      It seems, you forgot that you already have the script. Check this:

      Script to move images to seperate layer

      @David/@Mike, can you check with your database since it’s a same post with different urls.

      Script to move images to seperate layer

      Script to move images to seperate layer

      …and


      @Michel
      Allio for FRIdNGE, you were same on both urls.

Viewing 3 reply threads
  • You must be logged in to reply to this topic.
Forum Ads