7 Replies Latest reply on Mar 30, 2014 7:05 PM by Sudha K

    Difference beween links name and itemlink name

    Sudha K Level 1

      Hi,

       

       

        Wats the difference between the below two.  Both are returning links name only then wats the different...

       

      lnk = lnks[i];

      lnkName = File(lnk.parent.graphics[0].itemLink.filePath).name

      lnkName = lnk.name

       

       

      Thanks in advance,

      Sudha K

        • 1. Re: Difference beween links name and itemlink name
          Jump_Over Level 5

          Hi,

           

          As a source they are the same string, but

          link.name is localized and human-readable

          File.name is absolute URI, means encoded ==> i.e. space is represented by "%20"

           

          Jarek

          • 2. Re: Difference beween links name and itemlink name
            Sudha K Level 1

            difference between graphics and link name.  Any difference between these two?

             

            lnk.parent.graphics[0].itemLink.name

             

            lnkName = lnk.name

            • 3. Re: Difference beween links name and itemlink name
              Jump_Over Level 5

              Sorry, I am lost here...

               

              What is "lnk" in your code?

              If "lnk" is a link ==> lnk.parent is a graphic ==> lnk.parent.graphics[0] should return an error...

               

              Jarek

              • 4. Re: Difference beween links name and itemlink name
                Laubender Adobe Community Professional & MVP

                @Sudha – for the Links object you have two properties, the name or the whole path.

                 

                For a File object you have several options. If you want to compare the link.filePath to a File.path (both are strings), you first have to "convert" both of the strings to a common notation.

                 

                Let's chose a specific example to make that clear. An example from Mac OSX file system with a file path that contains some blanks and some umlauts.

                 

                We start with an InDesign document where one single JPEG file is placed. Nothing else.

                 

                //There is one JPEG file placed in the document. Nothing else.
                
                //Let's look at the filePath property of its Link object:
                
                var myPlacedFilePath = app.documents[0].allGraphics[0].itemLink.filePath;
                /*
                On my Mac OSX the result of myPlacedFilePath would be something like that:
                Macintosh HD:AUFTRAG:ISO MÖBEL_POLSTEROASE:BILDER:080915_DSCI6070.jpg
                */
                
                //NOW WE LOOK AFTER THE FILE IN THE FILE SYSTEM:
                var myFile = File(myPlacedFilePath);
                
                //LET'S SEE WHAT THE File Object HAS TO SAY:
                
                var absoluteURIofMyFile = myFile.absoluteURI;
                /*
                Result for absoluteURIofMyFile on Mac OSX would be something like that:
                /AUFTRAG/ISO%20MO%CC%88BEL_POLSTEROASE/BILDER/080915_DSCI6070.jpg
                */
                
                var fsNameOfMyFile = myFile.fsName;
                var fullNameOfMyFile = myFile.fullName;
                /*
                Result for fsNameOfMyFile OR fullNameOfMyFile on Mac OSX would be something like that:
                /AUFTRAG/ISO MÖBEL_POLSTEROASE/BILDER/080915_DSCI6070.jpg
                */
                

                 

                From this example you can see, that File.fullName is not the same as ItemLink.filePath. It is describing the same File.

                But a string by string comparison would fail.

                 

                Uwe

                • 5. Re: Difference beween links name and itemlink name
                  Sudha K Level 1

                  Ok thank you....

                   

                   

                  Actually i used this (lnk.parent.graphics[0].itemLink.name) to get link name but its returning empty for locked objects.  So used  this one (lnkName = lnk.name).

                   

                  Dono wats the difference between these two.  Both are returning the name.

                  • 6. Re: Difference beween links name and itemlink name
                    Laubender Adobe Community Professional & MVP

                    @Sudha – ah, now I know, what you mean.

                     

                    But I cannot confirm your observation, that the name property is an empty string in case a graphic is locked.

                     

                    What InDesign version are you using?

                    I tested with InDesign CS5.5 v7.5.3 on Mac OSX 10.6.8.

                     

                    Are you working on documents where 3rd party plug ins are used?
                    Or workflow software that control asset management. Or an InCopy workflow?

                     

                    Basically there is no difference between itemLink and link. It's the same object. Just another perspective to look at the same object.

                     

                    But, as I already said above in answer #4 there could be a difference in  string representation, if you compare the full path (including file name) of a link object and a file object in the operating system.

                     

                    Don't know exactly for Windows, but as I have shown, it could be a difference on Mac OSX.

                     

                    Uwe