🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #1279

Re: Positioning Inline images? [CS3 JS WIN]

#1279
From: Kasyan_Servetsky
Date: Fri, 13 Feb 2009 18:36
25 lines
1540 bytes

      need one that would search a story and, e.g., replace the text "Pencil.tif"
      with a graphic file named Pencil.tif from a given folder.




I've found in my archive a script written by Peter Kahrel (I modified it a little). It finds text between two @ characters – e.g. @Pencil.tif@ – and replaces it with image that has the same name and is in the root folder of C drive.

// reset the Find/Change dialog
app.findGrepPreferences = app.changeGrepPreferences = null;
// formulate a grep search string
app.findGrepPreferences.findWhat = '@.+?@';
// find all occurrence, last one first
f = app.activeDocument.findGrep (true);
for (i = 0; i < f.length; i++)
   {
   // construct file name
   name = f[i].contents.replace (/@/g, '');
   // place the pdf
   f[i].insertionPoints[0].place (File ('/c/' + name));
   }
// delete all @??@ codes
app.activeDocument.changeGrep()
Technical Details
Message-ID: <59b7e7c8.2@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
References: <59b7e7c8.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,af274cf8762a4d09
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Kasyan_Servetsky@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: Positioning Inline images? [CS3 JS WIN]
Message-ID: <59b7e7c8.2@webcrossing.la2eafNXanI>
Date: Fri, 13 Feb 2009 10:36:48 -0800
References: <59b7e7c8.-1@webcrossing.la2eafNXanI>
Lines: 15
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit