Copy link to clipboard
Copied
Hi Forum,
I have a big tricky thing to do with myself...
i have placed an image inside indesign document from desktop of my system(smb://172.11.11.0/). Saved and closed. and only the indesign file is sent to other person. (the other person has the same link in his system).
Can i be able to link the image placed inside the document automatically through script,
searching the missed link name, which is also available in other person system (smb://174.12.22.0/).
subfolder structures matches in both the system. only the IP address of machines changes...
eg. placed link location of my system (mac) is:
smb://172.11.11.0/user/Comics/Images/abc.tif
placed link location in other system (mac):
smb://174.12.22.0/user/Comics/Images/abc.tif
Only the IP address of the system is changing all other subfolders following IP address remains same...
Any help please....
Copy link to clipboard
Copied
Hi Forum,
I have also tried with this bit in PC system...
var myFolder = new File("~E:\script_29th_March\in testing");
//the location mentioned here is other system image folder location..
//previous locations of the placed image is
var myFolder = new File("C:\Documents and Settings\Chand\Desktop\script_29th_March\in testing")
var new_path = myFolder+ '/'
imgs = app.activeDocument.allGraphics
for (i = 0; i < imgs.length; i++)
{
img = imgs.itemLink
myFile = File (new_path + img.name);
if (myFile.exists) {
img.relink(File (new_path + img.name))
img.update()
}
}
so the subfolder \script_29th_March\in testing matches in both the system.
Copy link to clipboard
Copied
Try this:
var linksArr = document.links.everyItem().getElements();
for (var i = 0; i < linksArr.length; i++) {
var link = linksArr;
link.relink(link.filePath.replace("172.11.11.0", "174.12.22.0"));
link.update();
if (!link.isValid) {
throw new Error("Link " + link + " is not valid.");
}
var linkStatus = link.status;
if (linkStatus === LinkStatus.LINK_OUT_OF_DATE) {
throw new Error("Link " + link + " is out of date.");
}
if (linkStatus === LinkStatus.LINK_MISSING) {
throw new Error("Link " + link + " is missing.");
}
if (linkStatus === LinkStatus.LINK_INACCESSIBLE) {
throw new Error("Link " + link + " is inaccessible.");
}
}
Copy link to clipboard
Copied
thanks dln385,
I'll give a try in my office mac system tomorrow and let you know..
another question dln385,
about the second post of mine (Linking in PC).
when I give var myFolder = Folder.selectDialog("C:\Documents and Settings\Chand\Desktop.
the link is asking for path and relinked. but if I directly give the path...
var myFolder = new File("C:\Documents and Settings\Chand\Desktop\script_29th_March\in testing")
I dont know Y, it is not relinking...
any clarifications on this please...
Copy link to clipboard
Copied
Log out new_path + img.name.
$.writeln(new_path + img.name);
Check to see if it logs something different depending on whether or not you use the dialog.
Copy link to clipboard
Copied
Check out "Restore broken links after server migration" script.
Copy link to clipboard
Copied
thanks to a great Kasayn.
for given a poetic script continued to a page, I really stunned at it..
thanks G.....
I would be greatfull to you, if I can get the solution for this too..
where this script ask for folder/subfolders to select the missed file..
WHen i tried using to locate the link file directly, it is not working..
As, dln385, said i also used. $.writeln(new_path + img.name);, but still the problem persists.
please resolve...
var myFolder = new File("C:\Documents and Settings\Chand\Desktop\
(\\ instead of Folder.selectDialog, i'm trying to directly locate the link location)
var new_path = myFolder+ '/'
imgs = app.activeDocument.allGraphics
for (i = 0; i < imgs.length; i++)
{
img = imgs.itemLink
myFile = File (new_path + img.name);
if (myFile.exists) {
img.relink(File (new_path + img.name))
img.update()
}
}
Many thanks to Kasyan & dln385
Copy link to clipboard
Copied
Slightly diffent question here. Does anyone know of a script where from the listed images in links on Indesign, I can resize to 300 ppi(effective), then re-name images so changing the prefix, then resave them all to a new location specific for the hi res images. Then finally indesign relinks to new named files. That would be a great script if there was one.
Also is it possible to be selective on images, so certain directories (ie Stock images) can be left as is. Ie Not effected by script.
I have looked around and havent found anything so specific on Adobe, I am running Cs6 on PC. Which script format would be best?
I hope you can help
Find more inspiration, events, and resources on the new Adobe Community
Explore Now