1 2 3 Previous Next 89 Replies Latest reply: Feb 19, 2015 8:05 AM by markm23099703 RSS

    CS6 hyperlink problem

    gwhPoster Community Member

      Hi everyone,

       

      In Indesign CS6, I created a new URL hyperlink and pasted the following link into the field:

       

      http://law.ato.gov.au/atolaw/view.htm?docid=AID/AID2004688/00001

       

      But when I click OK and then look in the URL field in the hyperlinks panel, I see that Indesign has changed the link to the following:

       

      http://law.ato.gov.au/atolaw/view.htm%3Fdocid%3DAID/AID2004688/00001

       

      Notice how it's swapping out the question mark (?) after .htm with %3F.

       

      It's also swapping out the equals sign (=) with %3D.

       

      This breaks the URL and makes it no longer workable.

       

      I tried reinstalling Indesign but the problem still remains.

       

      I wondered if anyone knows why this is happening and whether there's a workaround?

       

      Appreciate any help.

        • 1. Re: CS6 hyperlink problem
          Laubender MVP

          @gwhPoster – That seems to be an encoding problem. Do you use a prerelease beta version of InDesign CS6?

           

          Background:
          It seems that every URL that is filled in in the Hyperlink palette is encoded with something like encodeURI() (a global ExtendScript function):

          string encodeURI (text: string)

          Encodes a string after RFC2396.

          Create an UTF-8 ASCII encoded version of this string. The string is converted into UTF-8. Every non-alphanumeric character is encoded as a percent escape character of the form %xx, where xx is the hex value of the character. After the conversion to UTF-8 encoding and escaping, it is guaranteed that the string does not contain characters codes greater than 127. The list of characters not to be encoded is -_.!~*'();/?:@&=+$,#. The method returns false on errors.

           

          To get it back to a working URL we could decode it by "decodeURI()":

           

          string decodeURI (uri: string)

          Decodes a string created with encodeURI().

           

          To correct that you could use the following script (JavaScript).

          (After running the script don't go to "Hyperlink options…" in the Hyperlink panel and hit "OK" since the URL is converted back and you have to run the script again to correct that!)

           

          JavaScript:

           

          //DecodeURI_AllHyperlinks_DestinationURL_Name.jsx
          //DESCRIPTION:Decodes all hyperlink destination URLs and names; can be undone in one go!
          //Uwe Laubender
          /**
          * @@@BUILDINFO@@@ DecodeURI_AllHyperlinks_DestinationURL_Name.jsx !Version! Mon Jun 04 2012 14:48:49 GMT+0200
          */
          
          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
          
          app.doScript(_DecodeURI_AllHyperlinks_DestinationURL_Name, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Decode all hyperlink URLs and names");
          
          function _DecodeURI_AllHyperlinks_DestinationURL_Name(){
          
          
          var d = app.documents[0];
          var allHyperlinks = d.hyperlinks;
          
          for(var n=0;n<allHyperlinks.length;n++){
          
              var newDestURL = decodeURI(allHyperlinks[n].destination.destinationURL);
              var newDestName = decodeURI(allHyperlinks[n].destination.name);
          
              allHyperlinks[n].destination.destinationURL = newDestURL;
              try{
              allHyperlinks[n].destination.name = newDestName;
              }catch(e){};
          
              };
          
          }; //END function "_DecodeURI_AllHyperlinks_DestinationURL_Name()"
          

           

           

          Hope that helps.

           

          Uwe

          • 2. Re: CS6 hyperlink problem
            gwhPoster Community Member

            Thanks for the reply,

             

            No it wasn't a pre-release - it's just CS6. I've contacted adobe and they were able to replicate the problem from their end but they haven't fixed the issue as yet. I may need to use your script if they don't provide a solution so thanks for posting it.

            • 3. Re: CS6 hyperlink problem
              Laubender MVP

              @gwhPoster – use the script with care. I did a little testing, but one never knows where it might fail…

               

              Uwe

              • 4. Re: CS6 hyperlink problem
                Laubender MVP

                @gwhPoster – in the meantime I filed a bug report. You should do that, too. The more people the more likely this issue will be fixed in the next round (InDesign 8.0.1).

                 

                Did you already test my script snippet?

                Does it work for you?

                Uwe

                • 5. Re: CS6 hyperlink problem
                  gwhPoster Community Member

                  Hi,

                   

                  No I'm still waiting for Adobe to respond with a solution to the link problem so I haven't used your script as yet. I just plan to wait a few more days to see if they come up with a fix and then I'll decide.

                   

                  Thanks again for posting it.

                  • 6. Re: CS6 hyperlink problem
                    Peter Spier ACP/MVPs

                    Stop holding your breath. These things take weeks, or maybe months to fix.

                    • 7. Re: CS6 hyperlink problem
                      gwhPoster Community Member

                      The guy on the phone said around 48 hours so I thought I'd wait at least until then and give them a call back. But you're probably right though - they may not have it done by then.

                      • 8. Re: CS6 hyperlink problem
                        Peter Spier ACP/MVPs

                        These froums are littered with posts about soomeone onthe phone promised to call back and never did. Do you have a case number? The names of everyone you talked to?

                        • 9. Re: CS6 hyperlink problem
                          gwhPoster Community Member

                          Yeah I have a name and a case number so I've got something to go by.

                          • 10. Re: CS6 hyperlink problem
                            Peter Spier ACP/MVPs

                            Well, good luck.

                            • 11. Re: CS6 hyperlink problem
                              gwhPoster Community Member

                              Thanks

                              • 12. Re: CS6 hyperlink problem
                                skim-creative

                                Hi,

                                 

                                I was struggling with the same problem but was able to make it work by opening the Hyperlinks panel and manually amending the characters in the URL field (i.e. delete "%3F", key in "?"). Seems to publish to PDF with no issues. Hope that helps!

                                • 13. Re: CS6 hyperlink problem
                                  Laubender MVP

                                  @skim-creative – try out my script. It will change all hyperlink URLs and hyperlink names. You can undo the action in one go if you like…

                                   

                                  Uwe

                                  • 14. Re: CS6 hyperlink problem
                                    nigelparrish

                                    Hi

                                     

                                    I tried your script. I.e I copied the text to a text editor and saved as a .jsx file and placed within the script folder. When I ran it it gave an error number 14, no matching closing brace found?

                                    Cheers Nigel

                                    • 15. Re: CS6 hyperlink problem
                                      Peter Spier ACP/MVPs

                                      Did you really copy the whole script? The braces look balanced to me.

                                      • 16. Re: CS6 hyperlink problem
                                        Laubender MVP

                                        @Nigel – I can assure you, my script posted in answer #1 is complete…
                                        No missing braces.

                                         

                                        Uwe

                                        • 17. Re: CS6 hyperlink problem
                                          nigelparrish Community Member

                                          Hi

                                          I will paste copied text (as below) into a text editor and save as a .jsx file and place within mt scripts. When I run it should I have text highlighted or just do so in the open document I want links to be corrected in?

                                           

                                          Cheers Nigel

                                           

                                          I have re-copied as this:

                                          //DecodeURI_AllHyperlinks_DestinationURL_Name.jsx
                                          //DESCRIPTION:Decodes all hyperlink destination URLs and names; can be undone in one go!
                                          //Uwe Laubender
                                          /**
                                          * @@@BUILDINFO@@@ DecodeURI_AllHyperlinks_DestinationURL_Name.jsx !Version! Mon Jun 04 2012 14:48:49 GMT+0200
                                          */


                                          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

                                          app.doScript(_DecodeURI_AllHyperlinks_DestinationURL_Name, ScriptLanguage.JAVASCRIPT, [], UndoModes.ENTIRE_SCRIPT, "Decode all hyperlink URLs and names");

                                          function _DecodeURI_AllHyperlinks_DestinationURL_Name(){


                                          var d = app.documents[0];
                                          var allHyperlinks = d.hyperlinks;

                                          for(var n=0;n<allHyperlinks.length;n++){

                                              var newDestURL = decodeURI(allHyperlinks[n].destination.destinationURL);
                                              var newDestName = decodeURI(allHyperlinks[n].destination.name);

                                              allHyperlinks[n].destination.destinationURL = newDestURL;
                                              try{
                                              allHyperlinks[n].destination.name = newDestName;
                                              }catch(e){};

                                              };

                                          }; //END function "_DecodeURI_AllHyperlinks_DestinationURL_Name()"

                                           


                                          • 18. Re: CS6 hyperlink problem
                                            Laubender MVP

                                            @Nigel – just run the script with a double-click. Nothing selected. Hyperlinks palette closed (but I think that's not necessary).
                                            Make sure that you save the script text in your text editor as "text only", that means not formatted eg to rtf or something..

                                             

                                            Are you on Mac OSX or on MS Windows?
                                            If on Mac, use TextEdit, copy the scripts' text to a new file, press cmd+shift+t to make it text-only.
                                            Make sure that text-only-saving is encoded to "Unicode (UTF-8)".

                                             

                                            Uwe

                                            • 19. Re: CS6 hyperlink problem
                                              Aussie_leah Community Member

                                              This does the same thing for me Just got CS6...so "advanced" it's got werid bugs that were never there before...grrrr!!! Very annoyed with Adobe right now. How do I report a bug?

                                              • 20. Re: CS6 hyperlink problem
                                                Aussie_leah Community Member

                                                Script doesn't work for me. Firstly, it opens a previous version the document which my new document in based on (and something opened recently) then it says "Error 45" object is invaild.

                                                • 21. Re: CS6 hyperlink problem
                                                  Laubender MVP

                                                  @Aussie_leah – tell me more about your OS. Are you on Mac OS X or MS Windows?
                                                  How were the steps you did? Can you show some screen grabs? Especially the "Error" message…


                                                  I wrote and tested the script on Mac OS X, could not test for MS Windows.
                                                  Btw: the script is not able to open a document…

                                                   

                                                  And: copy the code from answer #1 and make sure that you save it as a text only file.
                                                  Did you execute the script using the Scripts panel in InDesign CS6?

                                                   

                                                  Uwe

                                                  • 22. Re: CS6 hyperlink problem
                                                    Laubender MVP

                                                    How do I report a bug?

                                                     

                                                    @Aussie_leah – go there:

                                                     

                                                    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

                                                     

                                                    But do not expect Adobe answering…

                                                    Uwe

                                                    • 23. Re: CS6 hyperlink problem
                                                      Laubender MVP

                                                      @Aussie_leah – can you provide a test case for me? Just an IDML exported that I can download to test my script?
                                                      What kind of hyperlinks are you using?

                                                       

                                                      The script handles only destinations based on URLs…

                                                       

                                                      Uwe

                                                      • 24. Re: CS6 hyperlink problem
                                                        TonyRedhead Community Member

                                                        Hi Laubender,

                                                         

                                                        I've just upgraded to CS 6, stumbled across the same problem, and found this forum post. I've also posted a bug report so hopefully the more of us report reported the faster they may fix it.

                                                         

                                                        Thanks very much for the script, I'm on Mac OSx and it worked perfectly, will be a great help until Adobe fix the problem.

                                                         

                                                        Cheers,

                                                         

                                                        Tony

                                                        • 25. Re: CS6 hyperlink problem
                                                          Laubender MVP

                                                          @Tony – thank you for giving me positive feedback…

                                                           

                                                          I wonder if the bug is present in the MS Windows version of InDesign CS6?
                                                          I'm still on Mac OS X 10.6.8…

                                                           

                                                          And also wonder how this bug could slip through quality control. The new features of InDesign CS6 are very much centric to Digital-Publishing, Pad-, Phone-Publishing, and the Hyperlinks palette is central for building navigational elements in that area…
                                                          A glitch like that could damage the overall good user experience of the new version…

                                                           

                                                          @gwhPoster – did you ever try out my script?

                                                          Did it solve the problem for you?

                                                           

                                                          Uwe

                                                          • 26. Re: CS6 hyperlink problem
                                                            TonyRedhead Community Member

                                                            Hi Laubender,

                                                             

                                                            No problem, your script is a great help.

                                                             

                                                            I just loaded a trial version of old Windows XP machine I've got, and can confirm that the problem is also on the Windows version.

                                                             

                                                            The good news is that your script works just as well on Windows as it does on Mac OS X.

                                                             

                                                            Tony

                                                            • 27. Re: CS6 hyperlink problem
                                                              Aussie_leah Community Member

                                                              I am running on Windows 7. I copied and pasted the script into notepad and saved as a .jsx document. Found the scripts folder, pasted it in there and ran it through the scripts panel in InDesign. I don't know much (or anything) about scripts so I don't know if I did something wrong along the way.

                                                               

                                                              And yes, the bug is on the Windows version.

                                                               

                                                              Below is a screenshot of the error. Not sure if you can see much of it. But you might notice the tab opened at the top which opened itself when I ran the script.

                                                               

                                                              error.jpg

                                                               

                                                              Thanks for the link to the bug report page.

                                                              • 28. Re: CS6 hyperlink problem
                                                                Laubender MVP

                                                                @Aussie_leah – hm. This is rather unusual… I mean the tab with the "[converted]" document, that was opened immediately after starting the script.
                                                                "[Converted]" indicates, that there is a version from an older InDesign and opened. Why? I don't know…


                                                                Can you tell us more about the files you are working with and your workflow? The "e-news_0712.indd" and the other one converted. Did you open them from an older version of InDesign? Which one? Or, more important, are there other 3rd-party plug-ins installed?

                                                                 

                                                                The error message shown is unspecific, because I wrapped the whole functionality inside a function which in turn should be envoked by a "app.doScript()" function with some parameters, so that all actions can be made undone.

                                                                 

                                                                But before that, give my script another try.
                                                                But before doing that, export your InDesign file "e-news_0712.indd" to IDML, open that again in InDesign and run the version of my script against it.

                                                                 

                                                                If that is not working for you, try the following script code:

                                                                 

                                                                //Debug-version without undo for Aussie_leah exclusively
                                                                //if there is an error the ExtendScript Toolkit will be opened and the message will be written to the console.
                                                                
                                                                app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;
                                                                
                                                                var d = app.documents[0];
                                                                
                                                                if(d.hyperlinks.length === 0){alert("There are no hyperlinks in this document. Stop!");exit(0)};
                                                                
                                                                var allHyperlinks = d.hyperlinks;
                                                                
                                                                
                                                                for(var n=0;n<allHyperlinks.length;n++){
                                                                
                                                                    try{
                                                                    var newDestURL = decodeURI(allHyperlinks[n].destination.destinationURL);
                                                                    }catch(e){$.writeln(e.message); continue};
                                                                
                                                                    try{
                                                                    var newDestName = decodeURI(allHyperlinks[n].destination.name);
                                                                    }catch(e){$.writeln(e.message); continue};
                                                                
                                                                    try{
                                                                    allHyperlinks[n].destination.destinationURL = newDestURL;
                                                                    }catch(e){$.writeln(e.message); continue};
                                                                
                                                                    try{
                                                                    allHyperlinks[n].destination.name = newDestName;
                                                                    }catch(e){$.writeln(e.message); continue};
                                                                
                                                                    };
                                                                

                                                                 

                                                                This script code is without the "app.doScript()" function and instead there are some "try{}catch()" routines, that will hopefully show some more specific errors. They will start another application and write the error messages inside the console of that additional application that comes along with every inDesign installation, the ExtendScript Toolkit (ESTK). In case of an error the ESTK will be opened and the error message(s) will be written there as text so that you can easily copy/paste it.

                                                                 

                                                                Be aware, that with that script you cannot undo the scripts actions in one go. So be careful and save your InDesign file to a new name after executing the script.

                                                                 

                                                                Uwe

                                                                • 29. Re: CS6 hyperlink problem
                                                                  KarynRH Community Member

                                                                  The script worked perfectly for me. In fact, it worked so well and quickly that if I hadn't run a script before, I probably would have thought nothing happened. I saw the telltale asterisk that appears when the file has been changed so I knew it executed.

                                                                   

                                                                  Thanks so much for your help, Uwe. You truly do make a difference!

                                                                  • 30. Re: CS6 hyperlink problem
                                                                    ktroutman@deweypub.com Community Member

                                                                    We were having this same problem (Windows 7 & Windows XP)  and your script works great.   What a relief.  We publish a 4000 page book annually with close to 25,000 links, so you have saved me.  Thanks so much.

                                                                    • 31. Re: CS6 hyperlink problem
                                                                      Laubender MVP

                                                                      @KarynRH & @ktroutman – thank you both for your positive feedback.

                                                                       

                                                                      The original poster (OP), "gwhPoster", really should mark my answer in #1 as "correct"…
                                                                      But maybe he did not try out the script and is still waiting for a bug fix in the upcomming InDesign version 8.0.1, which is not announced, yet.

                                                                       

                                                                      Uwe

                                                                      • 32. Re: CS6 hyperlink problem
                                                                        KarynRH Community Member

                                                                        He should definitely mark it as correct. I used the script again today. I can't say I ever have a 4,000 page book or 25,000 links, but even with a half dozen links, it makes me very happy!

                                                                        • 33. Re: CS6 hyperlink problem
                                                                          Peter Spier ACP/MVPs

                                                                          I marked it -- one of the perks of being a moderator....

                                                                          • 34. Re: CS6 hyperlink problem
                                                                            gumbogypsy

                                                                            Hello! I also am having this problem. I tried running both of the suggested scripts; however, I get the following JavaScript error: Error Number 55. Error String: Object does not support the property or method 'destinationURL'

                                                                             

                                                                            Does anyone have an idea how to make the script work? I'm using CS6, Version 8 on Windows 7.

                                                                             

                                                                            Thanks in advance!!!

                                                                            • 35. Re: CS6 hyperlink problem
                                                                              Laubender MVP

                                                                              @almostlindy – can you give me an example of the URL or target link you are using?

                                                                               

                                                                              Uwe

                                                                              • 36. Re: CS6 hyperlink problem
                                                                                Laubender MVP

                                                                                I have to see into this and maybe expand the script.

                                                                                 

                                                                                There are several destinations for Hyperlinks:

                                                                                 

                                                                                HyperlinkExternalPageDestination

                                                                                HyperlinkPageDestination

                                                                                HyperlinkTextDestination

                                                                                HyperlinkURLDestination

                                                                                ParagraphDestination

                                                                                 

                                                                                Don't know, if all those types are buggy…

                                                                                 

                                                                                Uwe

                                                                                • 37. Re: CS6 hyperlink problem
                                                                                  gumbogypsy Community Member

                                                                                  Thanks!. An example url is: http://alamo.edu/main.aspx?id=5942. The hyperlink panel converts the ? and the = in the url, so that the resulting url is: http://alamo.edu/main.aspx%3Fid%3D5942.

                                                                                  • 38. Re: CS6 hyperlink problem
                                                                                    Laubender MVP

                                                                                    @almostlindy – My script should work well with that URL. Maybe there are other circumstances, that throw an error here…

                                                                                     

                                                                                    For testing, did you try the script together with a fresh InDesign document that has only the above hyperlink URL?

                                                                                     

                                                                                    How do you use the script?
                                                                                    Do you double click it from the Scripts Panel or do you start it from the ESTK (ExtendScript Toolkit)?

                                                                                     

                                                                                    Uwe

                                                                                    • 39. Re: CS6 hyperlink problem
                                                                                      Aussie_leah Community Member

                                                                                      Sorry for the delay in replying; I only do my e-news every 2nd month and last time I just used "tiny URL" to make the URL with equals signs and question marks work. But I have now tried the orginial script again and the same error occurred. I tried exporting the document as a IDML file but still the error came up. And I tried your new script on both the original and IDML file and neither worked.

                                                                                       

                                                                                      My document is based on a file that was originally made in CS3 as I use the same format every time. When I first used it with my new CS6, I saved it as a coverted file. Still doesn't make a lot of sense why the old (uncoverted) versions would be opening when running a script though.

                                                                                       

                                                                                      For me, this question is still unanswered and I can't see why Adobe won't fix it (maybe they can't). I know it will be a long time before I update to a new version of the Adobe suite again. I won't be giving them any more money just to keep producing new versions without proper checks.

                                                                                      1 2 3 Previous Next