Hi, sunday evening and a bit of time I'm puzzled by the actual Path you give: The actual path is: /Volumes/DTP/Produktbilleder/0893ny/0893_467+468_05_Agrp frit_.tif If I open a macfile including serverlinks on a PC-installation I get: \Volumes\BACKUP\06_Rubens_Thetis_Pau.jpg So I wrote a Script working with my path-result. You'll be asked for a folder that includes *.indd-files and for Networkdrives to work on. The script then tries to set the path based on the sharename which is mapped to a Networkcharacter (e.g. Z:, S: , ...) This worked well for 2 testfiles including missing maclinks to 10 files on 2 different servers: #target InDesign var IDversion = (app.filePath.displayName.split('CS'))[1]; main() function main() { var inddFiles = Folder.selectDialog ('Please choose folder with *.indd-files').getFiles('*.indd'); var shareNames = selDriveLetter(getActiveNetworkDriveLetters());//array(['R:', 'S:', ...], [sharename, ...] updateMissingMacLinks(inddFiles, shareNames); } function getActiveNetworkDriveLetters(){ var myVBScript = "Set myInDesign = CreateObject(\"InDesign.Application.CS" + IDversion + "\")\r"; myVBScript += "Set fso = CreateObject(\"Scripting.FileSystemObject\")\r"; myVBScript += "Set myDrives = fso.Drives\r"; myVBScript += "driveletters = \"\"\r"; myVBScript += "sharenames = \"\"\r"; myVBScript += "delimiter = \",\"\r"; myVBScript += "For Each drive In myDrives\r"; myVBScript += "If drive.isReady then\r"; myVBScript += "If drive.driveType = 3 then\r"; myVBScript += "driveletters = driveletters + drive.Path +delimiter\r"; myVBScript += "sharenames = sharenames + drive.sharename +delimiter\r"; myVBScript += "End If\r"; myVBScript += "End If\r"; myVBScript += "Next\r"; myVBScript += "myInDesign.ScriptArgs.SetValue \"drivesValue\", driveletters\r"; myVBScript += "myInDesign.ScriptArgs.SetValue \"sharesValue\", sharenames\r"; myVBScript += "\r"; app.doScript(myVBScript, ScriptLanguage.VISUAL_BASIC); var drivesString = app.scriptArgs.getValue("drivesValue"); var driveLettersArray = drivesString.split(','); driveLettersArray.pop(); var sharesString = app.scriptArgs.getValue("sharesValue"); var sharesArray = sharesString.split(','); sharesArray.pop(); return [driveLettersArray, sharesArray] } function selDriveLetter(array) { var myWindow = new Window ("dialog", "Please choose Networkdrives to operate on:"); var myInputGroup = myWindow.add ("group"); var sel = myInputGroup.add ("listbox", [0, 0, 300 , 150], array[0], {scrolling: true, multiselect: true}); var myButtonGroup = myWindow.add ("group"); myButtonGroup.add ("button", undefined, "OK"); myButtonGroup.add ("button", undefined, "Cancel"); if (myWindow.show() == 1){ var theSel = sel.selection; if(theSel === null){alert('Nothing choosed.'); exit();} var tmpList = []; for(var g = 0; g < theSel.length; g++) { tmpList.push(array[1][theSel .index]) ; } return tmpList; myWindow.close(); }else{ exit (); } } function updateMissingMacLinks(inddFiles, shareNames) { app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT; var l = inddFiles.length; if (l == 0){displayDialog('The selcted folder doesn\'t contain ID-Files'); exit();}; while(l--){ try{ var theDoc = app.open(inddFiles ); var allLinks =theDoc.links.everyItem().getElements(); for(var i = 0; i < allLinks.length; i++) { var currLink = allLinks; var currLinkStatus = currLink.status; switch(currLinkStatus) { case LinkStatus.LINK_MISSING : tryRelinking(currLink, shareNames); break; default : break; } } theDoc.save(inddFiles ); theDoc.close(); }catch (e){ app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL; displayDialog(e); app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT; } } app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL; } function tryRelinking(currLink, shareNames){ for(var sn = 0; sn < shareNames.length; sn++){ var brokenMacLinkPath = currLink.filePath; var newPicFilePath = (shareNames[sn] + '\\'+ ((brokenMacLinkPath.split('\\')).slice(3).join('\\\\'))).replace(/([^\\])\\([^\\])/g, '$1\\\\$2'); newPicFile = new File(newPicFilePath); if( newPicFile.exists === true){currLink.relink(newPicFile); break;} } } function displayDialog(aString){ var infoWindow = new Window("palette"); infoWindow.add("statictext", undefined, aString); infoWindow.show(); $.sleep(2000); infoWindow.close(); } Hans-gerd Claßen
... View more