Forum Moderators: open

Message Too Old, No Replies

Scripting for Adobe Indesign

         

stefansavva

3:31 am on Feb 9, 2005 (gmt 0)

10+ Year Member



Hi,
Does anyone have experience with writing Javascript for Adobe Indesign?

Im having trouble trying to write a script that reads a body of text and replaces image names with the actual images. So for example the script could read this body of text and replace this tag <apple.jpg> with the actual image file stored in a separate folder on my PC

Have searched thoroughly online and cannot find any existing javascript examples. All help greatly appreciated.

Stefan

SpaceFrog

4:40 pm on Feb 9, 2005 (gmt 0)

10+ Year Member



never done that for adobe indesign but what if I gave you the plain javascript that would do the job?

I would need to know how to retrieve full text to parse ...

document.getElementsByTagName('body').innerHTML 

it would then look like:

var FullText=document.getElementsByTagName('body')[0].innerHTML ;
var PictString="\<apple.jpg\>"
var PicCode="\<img src='apple.jpg' /\>"
var WithPics= FullText.replace(/PicString/g,PicCode)
document.getElementsByTagName('body')[0].innerHTML =WithPics