CS6 hyperlink problem

Contributor ,
Jun 01, 2012 Jun 01, 2012

Copy link to clipboard

Copied

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.

Views

57.9K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Jun 04, 2012 Jun 04, 2012
@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
...

Likes

Translate

Translate
Adobe Community Professional ,
Jun 04, 2012 Jun 04, 2012

Copy link to clipboard

Copied

@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.destination.destinationURL);

    var newDestName = decodeURI(allHyperlinks.destination.name);

    allHyperlinks.destination.destinationURL = newDestURL;

    try{

    allHyperlinks.destination.name = newDestName;

    }catch(e){};

    };

}; //END function "_DecodeURI_AllHyperlinks_DestinationURL_Name()"

Hope that helps.

Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 04, 2012 Jun 04, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 04, 2012 Jun 04, 2012

Copy link to clipboard

Copied

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

Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

@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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

Well, good luck.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 05, 2012 Jun 05, 2012

Copy link to clipboard

Copied

Thanks

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 05, 2012 Jul 05, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 05, 2012 Jul 05, 2012

Copy link to clipboard

Copied

@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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 08, 2012 Jul 08, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Jul 08, 2012 Jul 08, 2012

Copy link to clipboard

Copied

@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.destination.destinationURL);

    }catch(e){$.writeln(e.message); continue};

    try{

    var newDestName = decodeURI(allHyperlinks.destination.name);

    }catch(e){$.writeln(e.message); continue};

    try{

    allHyperlinks.destination.destinationURL = newDestURL;

    }catch(e){$.writeln(e.message); continue};

    try{

    allHyperlinks.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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Sep 04, 2012 Sep 04, 2012

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Sep 05, 2012 Sep 05, 2012

Copy link to clipboard

Copied

@Aussie_leah – sorry, to hear that…

I cannot offer a solution to your problems. Maybe there is no solution…
Without testing with your original files I cannot say, if it's possible at all to work around that bug.

I fear we have to wait for a bug fix by Adobe.
Working with a ".0.0" version sometimes (or often) brings trouble in real world production workflows. It's not only Adobe…

Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Oct 30, 2012 Oct 30, 2012

Copy link to clipboard

Copied

@Aussie_leah – unfortunately we have to wait (and pray?) that the next bug fix round will resolve this problem.
Version 8.0.1 does not…

Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 09, 2013 Jan 09, 2013

Copy link to clipboard

Copied

I have run into the same issue, don't pretend to have an answer for all the variables, but I do want to share a solution that is working for me.

Briefly, I need to embed hyperlinks to Google Maps from within Indesign/ePub. When I first attempted this, using hyperlinks that worked directly out of Word/Excel, etc., I, too, was getting extra characters inserted into my hyperlink in Indesign, causing the ePub link to fail. I contacted Adobe (case# 183925742). They indicated they problem was "hidden characters" within Excel, which is where I maintain my long list of Google hyperlinks. This is true--they had me cut and paste into notepad, then access Google Maps, then cut and paste back into Notepad, and then over to Indesign. To their credit, it worked.

However, I just found another, simpler solution, for what I am trying to accomplish, so here it is, and I hope it is helpful.

If I cut and past my hyperlink from Excel directly into my web browser, Google is able to "read my command line.  For example, my Excel string to find the Seaboard Air Line Railroad Depot in McBee, South Carolina is immediately below.  When I would try to paste this into Indesign/ePub, it would not properly export or link.   

Example: http://maps.google.com/maps?f=q&q=34.469167,-80.2575%20%28Seaboard%20Air%20Line%20Railroad%20Depot%2...

When this strink is entered into my web broswer, my web browser (Google) reads it and converts it to:

Example: https://maps.google.com/maps?f=q&q=34.469167,-80.2575+(Seaboard+Air+Line+Railroad+Depot+McBee+)

This is very different than my Excel link!

I then copy and past the converted string into Indesign, in the URL command line that is DIRECTLY below the very top of the Hyperlink pop up window.  I DO NOT use a secondary pop up window for the specific "paste."  I hope that makes sense.  In short, there are of course multiple ways to enter hyperlinks, but by using the URL "command line" near the top of the main pop-up, and then pasting in the "converted" Google Maps string, all of this now works for me.  I have exported approximately 40 such links to ePub, copied my ePub to my iPad, and am able to click on the link and go directly to Google Maps.

There may be a better way--I am hardly an expert w/Indesign, but this solved a major problem, at least for me.

I hope it's of value, BF  

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 09, 2013 Jul 09, 2013

Copy link to clipboard

Copied

Just a quick note to say that I am using InDesign CC and encountered this issue with hyperlinks. This script worked perfectly and all the links are now working and this has saved me a couple hours of copying and pasting the links back in manually in Acrobat!

Thank you!!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 26, 2013 Jul 26, 2013

Copy link to clipboard

Copied

Thank you this was very helpful! I was using Window 7 and the fix worked where the others created errors.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 26, 2013 Jul 26, 2013

Copy link to clipboard

Copied

Sorry I forgot to mention I'm a Windows 7 user as well.  For me the work around - isn't an after the fact "work around"; it's actually using the tool's features. It's what I use when I'm creating links as I'm building a document.  The previous comment (77.KarynRH) souunded like someone looking for a solution - after - a document had already been created discovering the links didn't work. I could see the applicability of a script in that regard.  I'm not a professional ID user, and I'm probably not using the most efficient workflow given I test my document as I'm building it.  Anyway, I hope it helps.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 29, 2013 Jul 29, 2013

Copy link to clipboard

Copied

Nope, it's just faster when I'm creating the document to create the hyperlinks as I did in CS5.5 (using the Hyperlinks panel), and then run the script when I've placed all of the links. Saving five seconds per link may not seem like much to you but I usually have enough hyperlinks that it adds up to something noticeable, especially since most of my hyperlinks are text and require a specific character style.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Aug 27, 2013 Aug 27, 2013

Copy link to clipboard

Copied

I wonder if the issues with the Hyperlink URL encoding are now solved with InDesign's recent bug fix version 9.1.0 (InDesign CC):

http://helpx.adobe.com/indesign/release-note/indesign-cc-9-1-0-release-notes.html

Special characters such as ‘?’ or ‘=’ used in hyperlinks are converted to invalid characters and this results in broken links in the exported PDF. (#3554342)

Cannot test that, did not install CC …

Uwe

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines