Hyperlink Script
I am new to scripting but I have a problem that seems to be a good candidate for a script.
I am working on a catalog that is being converted from Pagemaker 7 to Indesign CS4. The conversion has corrupted all the text anchors and now have to be redone. The hyperlinks are still there but the anchors all point to the beginning of the text frame.
There are about 40 sections with about 150 links in each section. This is way too many to do by hand so I figured a script would be just the thing.
The catalog is broken down into a seperate file for each section which holds one unit for each section. The first two pages for each section shows every part inside that unit and the rest of the pages are a list of part numbers and descriptions. The image for each piece has a text frams as a label which is a hyperlink to the part number and description later in the document.
I think it would be done best in two scripts. (JS or VBS doesn't matter) The first script would be simple. I would highlight a part number and run the script which would create a Hyperlink Destination (Text Anchor) with the same name as the highlighted text. Simple, but it would cut down on the number of clicks considerably.
The second script would use the existing Hyperlinks in the document and link them to the new destinations. Each section covers a single unit number, such as 40 or 105. The unit number is the first half of the part number. The second half is the piece number, which is the first 3 numbers in the name of the Hyperlink. Thus Unit 40 piece 304 would have a part number of 40304, the name of the text anchor. All of the part numbers in that section will have the same unit number.
Basically it would work like this:
- Highlight unit number
- Run script
- Script takes first hyperlink and changes destination to (Unit Number) + (First 3 numbers of Hyperlink Name)
- Repeat with all remaining hyperlinks
So if the unit number was 40 and the first Hyperlink was named 120-2 then it would point to the text anchor named 40120.
This would take VERY long to do by hand and I would appreciate any help that you could give me with this problem. If you have heard about this anchor corruption issue before and know how to avoid it, that would also be helpful.