0 Replies Latest reply on Nov 11, 2013 8:28 AM by Ferrarezzi

    links according to the folder where the file is?

    Ferrarezzi Level 1

      I have this script that I found here on this forum and would like to change it so that when you execute it according to relink the file name

       

       

      # target illustrator

       

       

      linkReplacer function ( ) {

           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 ;

           }

       

       

           defaultFolder var = new Folder ( ' ~ / Desktop ' ) ;

           psdFolder defaultFolder.selectDlg var = ( ' Please select the folder of your replacement files ');

           if ( psdFolder == null) return ;

          

           with ( docRef ) {

                placedFiles var = 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 ();

       

       

      for example

       

       

      filename > TESTE_0000_CLOSED_01

      link contained in the file > TESTE_0000_INDEX

      link contained in the file folder ( TESTE_0000_CLOSED_01 ) is TESTE_0000_INDEX_01

       

       

      after running the file the link is > TESTE_0000_INDEX_01

       

       

      I do not know if I was clear is complicated to explain

       

       

      when run this script searches the linked item in the folder where it is saved, like that instead he relink the file contained in the folder under the file name