• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to Remove Layer Groups by Name

Guest
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

Hello - I am looking for help creating Javascript to remove Groups within Layers by Name. I began with an SVG file with different layers which I have subsequently saved as an AI file (Windows 7 Professional, Adobe Illustrator CS6). I now have many clipping mask bounding rectangles that cannot be removed, they are contained within groups named "SVGID." I previously ran a script to remove all clipping masks that deleted the unnecessary clipping paths, but I am still left with these SVIG groups that somehow contain the bounding rectangles. So I think the easiest way would be to run a script to remove all <Group> with name/label SVGID, but I am open to other suggestions. Thanks!!

GroupsSVGID.JPG

TOPICS
Scripting

Views

2.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Valorous Hero , Mar 23, 2017 Mar 23, 2017

Try to run it after changing "groupItems" to "pageItems". I hope that could help.

Votes

Translate

Translate
Adobe
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

Moving to Illustrator Scripting​

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

Try the following snippet:

#target illustrator

function test(){

     var doc = app.activeDocument;

     var flag = true;

     while(flag){

          try {

               doc.groupItems.getByName("SVGID").remove();

          } catch(e) {

               flag = false;

          }

     }

};

test();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

Hi Silly-V - Thanks for the snippet. It does not seem to do anything on my end. After selecting all artwork in AI, I have saved the snippet as a jsx file (from Notepad) and executed it in AI by using File > Scripts > OtherScripts. All the SVGID groups are still there after these steps. Am I running the code incorrectly?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

Try to run it after changing "groupItems" to "pageItems". I hope that could help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Mar 23, 2017 Mar 23, 2017

Copy link to clipboard

Copied

LATEST

Awesome, that worked, THANK YOU!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines