5 Replies Latest reply on Oct 13, 2012 7:55 AM by MTOSSA

    Path problem when moving from Mac to PC




      I'm trying to move our Adobe InDesign installation from Mac to PC, but I ran into a path problem. A lot of our publications/documents in Adobe InDesign have linked to pictures in the filesystem (Windows 2008 R2 server). It goes like this:


      DTP:Produktbilleder:0893ny:0893_467+468_05_Agrp frit_.tif


      And is linked like this directly from InDesign.


      Billede 2.png



      The actual path is:

      /Volumes/DTP/Produktbilleder/0893ny/0893_467+468_05_Agrp frit_.tif


      On the PC I cannot use that path notation and have to go like this:


      F:\DTP\Produktbilleder\0893ny\0893_467+468_05_Agrp frit_.tif


      When the publication/document in InDesign have the Mac link "hardcoded" the PC path will not work.


      Is there a relatively easy way to get the InDesign on PC to use the Mac link or does one have to change all the "hardcoded" links in the publications/documents?


      I have tried the "Links Panel" solution to relink all files. But unfortunately it seems to be that all the files have to be in the same folder. It is not "recursive" as I see it. And since we have tens of thousand of pictures in thousands of different folders it does not seem to work.


      I hope you understand my question - don't hesitate to ask for more info.


      Best Regards


        • 1. Re: Path problem when moving from Mac to PC
          -hans- Level 4



          if you just have to change '/Volumes/DTP/Produktbilleder/0893ny/0893_467+468_05_Agrp frit_.tif' to 'F:/DTP/Produktbilleder/0893ny/0893_467+468_05_Agrp frit_.tif'


          then loop the documentlinks, check status, if missing get filePath, replace '/Volumes' with 'F:', check if file exists, if true -> relink.


          '/Volumes/DTP/Produktbilleder/0893ny/0893_467+468_05_Agrp frit_.tif'.replace(/\/Volumes/, 'F:')

          Hans-gerd Claßen

          • 2. Re: Path problem when moving from Mac to PC
            -hans- Level 4



            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:



            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];
            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(',');
            var sharesString = app.scriptArgs.getValue("sharesValue");  
            var sharesArray = sharesString.split(',');
            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[g].index])   ;
            return tmpList;   
                    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();};
            var theDoc = app.open(inddFiles[l]);
            var allLinks =theDoc.links.everyItem().getElements();
            for(var i = 0; i < allLinks.length; i++)
            var currLink = allLinks[i];
            var currLinkStatus = currLink.status;
            case LinkStatus.LINK_MISSING : tryRelinking(currLink, shareNames); break;
            default : break;
            }catch (e){
                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
                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);   



            Hans-gerd Claßen

            1 person found this helpful
            • 3. Re: Path problem when moving from Mac to PC
              Adobenoob Level 1

              Hi Hans,


              Very nice work - I'm impressed.


              I will try it out tomorrow - my day today was a really monday with to much other work :-(


              I will keep you informed.




              • 4. Re: Path problem when moving from Mac to PC
                Adobenoob Level 1

                Hi Hans,


                I have now testet the script and it seems to work perfect. Now the personnel in the DTP department are in the process of testing it.


                Very nice.


                Thank you very much.




                • 5. Re: Path problem when moving from Mac to PC
                  MTOSSA Level 1

                  Hi Hans,


                  How would this script go if I needed the opposite relinking, i.e. PC INDD files going to Mac?



                  Mark (new Mac user, former PC-lifer)