Creating URLs to Anchors - my solution.

Please post all questions and comments regarding Help & Manual 7 here.

Moderators: Alexander Halser, Tim Green

Post Reply
Tim Frost
Posts: 319
Joined: Mon Nov 22, 2004 11:45 pm

Creating URLs to Anchors - my solution.

Unread post by Tim Frost »

Recent discussion here has reminded me how irritating it is when the simple task of sending someone a link to a help anchor involves so many steps and is subject to my spelling errors, forgotten syntax, and forgotten lower-casing. I understand that it is hard to build a general way to simplify this task into Help&Manual.

For my own use I have therefore written a simple Windows program (AddAnchor.exe) to resolve this. It (currently) supports only a single URL style for anchors (the one that my main project needs). And the user needs to have read access to the H&M Topics folder of the help project, but does not need to use H&M. The program has a small window which can be opened when needed, or left on the task bar for re-use. The first time you run AddAnchor, you enter the path to the Topics folder, which is saved in the registry; you can change this at any time.

To use AddAnchor, you first open the permalink menu on your Web Help and copy the topic URL as usual. When you then open or click on the AddAnchor Window, the program looks at the content of the clipboard, which it ignores if it is not a URL, or if it does not end with the name of a topic which has a matching XML file in the Topics folder. If it finds your topic, the the topic title will be displayed in the Window, and a pull-down box will be filled with all the anchor names in the topic. It's very quick because it can go direct to the XML topic file it needs to read.

Clicking on the pull-down and selecting the anchor you need then appends ?anchor= and the (lowercased) anchor name to the original clipboard content, and replaces the text on the clipboard, ready for you to paste a valid link into wherever you need it. The program could theoretically have an option for other anchor URL syntax, and it could also be modified to read the topic file from an HMXZ file; I have no need for this myself but it should not be hard to add.

I plan to let this program bed in for a week or so, but then if it is of use to anyone else I would be happy to send them a copy, to use at their own risk, and without any guarantee to modify it for any future H&M changes to the XML file syntax. It writes nothing to the disk apart from saving the last Topics folder name used, and it only modifies the content of the Windows clipboard.
Post Reply