Skip navigation
Currently Being Moderated

CS6 hyperlink problem

Jun 1, 2012 7:16 PM

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.

 
Replies 1 2 3 Previous Next
  • Currently Being Moderated
    Jun 4, 2012 5:52 AM   in reply to gwhPoster

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 4, 2012 6:25 AM   in reply to gwhPoster

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

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 5, 2012 9:18 AM   in reply to gwhPoster

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 5, 2012 4:06 PM   in reply to gwhPoster

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 5, 2012 4:12 PM   in reply to gwhPoster

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 5, 2012 4:18 PM   in reply to gwhPoster

    Well, good luck.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2012 7:52 AM   in reply to gwhPoster

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2012 1:32 PM   in reply to skim-creative

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 1:09 AM   in reply to Laubender

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 3:14 AM   in reply to nigelparrish

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

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 3:23 AM   in reply to nigelparrish

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

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 4:43 AM   in reply to Laubender

    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()"

     


     
    |
    Mark as:
  • Currently Being Moderated
    Jun 27, 2012 5:02 AM   in reply to nigelparrish

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 10:02 PM   in reply to gwhPoster

    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?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 10:33 PM   in reply to Laubender

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 5, 2012 11:26 PM   in reply to Aussie_leah

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 12:50 AM   in reply to Aussie_leah

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 1:07 AM   in reply to Aussie_leah

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 6, 2012 8:42 PM   in reply to Laubender

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 7, 2012 1:37 AM   in reply to Tony Redhead

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 7, 2012 3:46 PM   in reply to Laubender

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 8, 2012 5:12 PM   in reply to Laubender

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 8, 2012 11:07 PM   in reply to Aussie_leah

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 24, 2012 10:02 AM   in reply to Laubender

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 6:52 AM   in reply to Laubender

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 10:34 AM   in reply to ktroutman@deweypub.com

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 10:41 AM   in reply to Laubender

    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!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 1, 2012 1:01 PM   in reply to Laubender

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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 7:25 AM   in reply to gwhPoster

    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!!!

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 7:57 AM   in reply to almostlindy

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

     

    Uwe

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 8:05 AM   in reply to Laubender

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 22, 2012 8:28 AM   in reply to Laubender

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 23, 2012 12:50 AM   in reply to almostlindy

    @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

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 4, 2012 10:58 PM   in reply to Laubender

    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.

     
    |
    Mark as:
1 2 3 Previous Next
Actions

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points