Hello, everyone.
I am writing the script for relinking on illustrator file. It is perfectly working on illustrator CC2014. but I got the issue on illustrator CC2017 and illustrator CC2018.
Note: I am mentioned manual link location and Script linked locations differ on link palate location. snapshot for your reference.
kindly advice how to mention the folder location in the script.
Issue reference:
Folder structure reference:
Script reference:
#target illustrator-21
function linkReplacer() {
var orginalUIL = app.userInteractionLevel;
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
if (app.documents.length == 0) {
alert('Please have an "Illustrator" document open before running this script.');
return;
} else {
docRef = app.activeDocument;
}
var defaultFolder = new Folder (Folder(app.activeDocument.path + '/../040 Images/043 High Res'));
var psdFolder = defaultFolder;
if (psdFolder == null) return;
with (docRef) {
var placedFiles = new Array();
for (var i = 0; i < placedItems.length; i++) {
placedFiles.push(placedItems[i].file.name);
}
for (var j = 0; j < placedItems.length; j++) {
var rePlace = new File(psdFolder.fsName + '/' + placedFiles[j]);
if (rePlace.exists) {
placedItems[j].file = rePlace;
} else {
alert('File "' + placedFiles[j] + '" is missing?');
}
}
}
app.userInteractionLevel = orginalUIL;
}
linkReplacer();