JS CS3 Relink image to new path
I've put a script together that resizes images in a doc. What I've been able to do is rename the resized image and then relink to the renamed images. I'd like to be able to have all the resized images saved into the folder using the doc name which is not hard. What I am finding difficult is setting the path to that folder for the relink.
for example:
var myLinks = app.activeDocument.allGraphics;
var myFpath = myLinks[0].itemLink.filePath
var myFname = myLinks[0].itemLink.name
$.write(myFpath.replace(myFname,app.activeDocument.name+"/"+myFname) +"\r");
returns C:\hold\Untitled-1/file_24791_Scaled.tif
if I try and change +"/"+ to +"\"+ the remaining code is commented out I've also tried "/\/" which returned //
should I try using replace to return /C/hold/Untitled-1/file_24791_Scaled.tif which should work on both PC and Mac?
Any suggestions would be appreciated.
Cheers, John.