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

[ Branched ] How to relink all embedded images under clipping mask

Community Beginner ,
Mar 12, 2019 Mar 12, 2019

Copy link to clipboard

Copied

Hey pixxxel schubser It works for link image.
But i have many files with embedded image under clipping mask. Could you help make a change the script for it? Thanks

[ Branched by moderator from previous discussion ] --> relink all selected

TOPICS
Scripting

Views

886

Likes

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

Community Expert , May 12, 2019 May 12, 2019

here you go, you still need to select the clipped images (the images themselves, not the mask). You can do that with the group selection tool

 

//#target Illustrator
 
// script.name = relinkAllSelected.jsx;
// script.description = relinks all selected placed images at once;
// script.required = select at least one linked image before running;
// script.parent = CarlosCanto // 7/12/11; 05/12/19 updated for CC2019
// script.elegant = false;
 
var idoc = app.activeDocument;
sel = idoc.selection;
i
...

Likes

Translate

Translate
Explorer ,
May 11, 2019 May 11, 2019

Copy link to clipboard

Copied

This is what I would need as well

Likes

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
Community Expert ,
May 12, 2019 May 12, 2019

Copy link to clipboard

Copied

here you go, you still need to select the clipped images (the images themselves, not the mask). You can do that with the group selection tool

 

//#target Illustrator
 
// script.name = relinkAllSelected.jsx;
// script.description = relinks all selected placed images at once;
// script.required = select at least one linked image before running;
// script.parent = CarlosCanto // 7/12/11; 05/12/19 updated for CC2019
// script.elegant = false;
 
var idoc = app.activeDocument;
sel = idoc.selection;
if (sel.length>0) {
      var file = File.openDialog ("open file");
      file = new File(file.fsName.replace("file://","")); // Mac OS Lion fix by John Hawkinson
      
      for (i=0 ; i<sel.length ; i++ ) {
           if (sel[i].typename == "PlacedItem") {
                var iplaced = sel[i];
                iplaced.file = file;
             }
           if (sel[i].typename == "RasterItem") {
                var iplaced = idoc.placedItems.add();
                iplaced.file = file;
                
                iplaced.move(sel[i], ElementPlacement.PLACEBEFORE);

                h = sel[i].height;
                w = sel[i].width;
                x2 = sel[i].left;
                y2 = sel[i].top;

                iplaced.position = [x2+w/2-iplaced.width/2, y2-h/2+iplaced.height/2];
                
                sel[i].remove();
             }
       }
}
else
     {
          alert("select at least one placed item before running");
     }

Likes

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
Community Beginner ,
May 13, 2019 May 13, 2019

Copy link to clipboard

Copied

It's works. Thank you so much!

Likes

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
New Here ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

hello. failed to execute.

(Adobe Illustrator 2023/Mac OS Monterrey)

Captura de Pantalla 2023-01-24 a la(s) 04.23.33.png

 Thanks.

Likes

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
Community Expert ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

LATEST

Save as plain Text in your text editor (not in Word for example) then rename as *.jsx

Likes

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