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

Script to select all images on artboard

Engaged ,
Aug 05, 2023 Aug 05, 2023

Hi all

I have an artboard that contian images and shapes around it

I need script that select all images , move them ( cut ) to a new layer , shapes around images in move to another layer without images

Thanks

TOPICS
Scripting
549
Translate
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
Adobe
Guide ,
Aug 05, 2023 Aug 05, 2023
var doc = app.activeDocument;
doc.layers.add().name = "Images";
doc.layers.add().name = "Linked Files";
doc.layers.add().name = "Other";
for (var i = 0; i < doc.pageItems.length; i++) {
    if (doc.pageItems[i].typename == "RasterItem") {
        move(doc.pageItems[i], doc.layers["Images"]);
    } else if (doc.pageItems[i].typename == "PlacedItem") {
        move(doc.pageItems[i], doc.layers["Linked Files"]);
    } else {
        move(doc.pageItems[i], doc.layers["Other"]);
    }
}
function move(what, where) {
    what.move(where, ElementPlacement.PLACEATEND);
}
Translate
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
Engaged ,
Aug 05, 2023 Aug 05, 2023

Thanks for Your reply

But the script work on some images and some images not work

Ex : I want all images move to layer 1 without its frames

all frames move to layer 2 without images

Here is the pdf file open it in illustrator

Translate
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
Community Expert ,
Aug 05, 2023 Aug 05, 2023

Hi @r28071715i111 

A little side note:

The script from @femkeblanco works exactly as you described. Unfortunately, you forgot to mention that there are dozens of nested clipping groups in your file and furthermore compound path items in some groups exists.

 

It might also be helpful to specify the correct Illustrator version. Because not every helper here in the forum always uses the latest version.

Translate
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
Engaged ,
Aug 06, 2023 Aug 06, 2023
LATEST

Thanks For your Reply

You are correct , I forgot to mention that there are dozens of nested clipping groups in your file and furthermore compound path items in some groups exists.

What is the script in this case ?

I use illustrator 2023

Translate
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