8 Replies Latest reply on Aug 8, 2011 8:48 AM by JoseAjáAjá

    JavaScript error: [Hyperlinks] "...received Text, but expected (Text)..."

    JoseAjáAjá Level 1

      Hi guys.

       

      I'm trying to create a hyperlink, based on the currently selected text, to point to the last page in the document. (just to learn hyperlinks)

       

      My script is as follows:

       

      function createTheHyperlink(){
          var mySource = app.activeDocument.hyperlinkTextSources.add(
              app.activeDocument.selection
              );
          var myDestination = app.activeDocument.hyperlinkPageDestinations.add(
              app.activeDocument.pages.lastItem()
              );
          app.activeDocument.hyperlinks.add(
              mySource,
              myDestination
              );   
      }
      
      
      

       

      I select a word, and run the script. But the following crazy error message pops up:

       

      JavaScript Error!
      
      
      Error Number: 30477
      Error String: Invalid value for parameter 'source' of method 'add'. Expected Text, but received (Text).
      
      
      Engine: main
      ...
      

       

      Pic:

      foro1.JPG

       

      So, the questions are:

       

      1- Why am I getting this error?

      2- What is the difference between Text and (Text)?

       

      Thank you all!

       

      Jose