🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2059

Re: [CS2][JS]Relink images for web and print

#2059
From: Kasyan Servetsky
Date: Wed, 07 Jan 2009 17:11
22 lines
1181 bytes
Hi Charles,
Try this:


 
var myImages = app.activeDocument.allGraphics;
for (i = myImages.length-1; i >= 0 ; i--) {
   var myImage = myImages[i].itemLink;
      if (myImage.filePath.match("_web") != null) {
         var myNewName = myImage.filePath.replace(/_web/, "_print");
      }
      else if (myImage.filePath.match("_print") != null) {
         var myNewName = myImage.filePath.replace(/_print/, "_web");
      }
   var myNewLink = new File (myNewName);
   if (myNewLink.exists) {
    myImage.relink (myNewLink);
    myImage.update();
   }
}

Kasyan
Technical Details
Message-ID: <59b771d1.10@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b771d1.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,c83165d1b590d57
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Kasyan Servetsky" <askoldich@yahoo.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: [CS2][JS]Relink images for web and print
Message-ID: <59b771d1.10@webcrossing.la2eafNXanI>
Date: Wed, 7 Jan 2009 09:11:47 -0800
References: <59b771d1.-1@webcrossing.la2eafNXanI>
Lines: 17
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit