3 Replies Latest reply on Mar 27, 2011 7:25 PM by dylw

    AS CS3 - Create a list of links excluding duplicates

    dylw Level 1

      I want to create a list of links in a document, but, if an images link appears more than once in a document I don't want it to appear more than once in the list. At first I thought, yeah this should be easy and at first glance it is, until I decided that I only wanted to record the link that has the largest scaling factor out of all its duplicates on the page.

       

      I'd give you examples of my code so far, but they are so broken and convoluted that I have completely confused myself and I will probably throw you off track of what I am trying to achieve.

       

      Any pointers would be greatly appreciated

        • 1. Re: AS CS3 - Create a list of links excluding duplicates
          Kasyan Servetsky Level 5

          I did it in my script: http://www.kasyan.ho.com.ua/resize.html

           

          It's in JS, but a similar approach can be used in AS. See findLargestLink function.

           

          Kasyan

          1 person found this helpful
          • 2. Re: AS CS3 - Create a list of links excluding duplicates
            Randomsen

            you can evaluate as to whether a certain object is in a list with AS

            tell application "Adobe InDesign CS3"
                set mylinks to name of every link of active document
                set mylist to {}
                repeat with i from 1 to number of items in mylinks
                    set mylink to item i of mylinks
                    if mylink is not in mylist then
                        set end of mylist to mylink
                    end if
                end repeat
                return mylist
            end tell

             

             

             

            You can do the same things with object references (instead of list of text strings like this), it just takes longer.

             

             

            ~mike

            1 person found this helpful
            • 3. Re: AS CS3 - Create a list of links excluding duplicates
              dylw Level 1

              Thanks for the responses guys, and sorry for the delay in responding. I must admit I had forgotten about this and I haven't been on the forums in so long. From today I am going to try and be a more constructive and active member.

               

              Randomsen you gave me the push I needed to move forward, but I really struggled with the coding to find the link with the largest scaling so that it was the only item in the new list. In the end I decided that I would process every link and save each as a version.