Hyperlink with a calculated link

  • I think there might have been a small language problem. I am now guessing that you have a document with a hyperlink and you want the link to be calculated when the user clicks it.

    If that's right I think you need the HyperlinkEvent or OnTextObjectClick event. The version 6 OLH recommends OnClickHotText

    If the latter you'll need to test if it was a hyperlink object

    When the event responds to the click or double click (can't remember which) in the code for the event you can calculate the URL and do what you like with it.

  • Hi,

    I need the URL to be calculated while I run WPSuperMerge.Execute. I want to be able to have a field/function in the URL similar to how I have fields/functions in the merged document.

    I don't have any click events, because the document is being exported.

    Thanks
    Vitaly

  • That would have been useful information to post at the start.

    I never bought WPReporter so all I can go in is the WPTools manual. It looks as though there is an event on the WPSuperMerge component OnGetText which is a bit like the mailmerge event. Possibly that will do what you want.

  • Hi,

    Sorry, I was sure this is all called WPTools therefore didn't specify this.

    Regarding OnGetText, this would be a solution if it will be possible to define a URL as a field. However this is exactly my problem. I can't find a way to insert a field into Hyperlink URL.

  • I don't know if this will help but stop thinking of it as a document and a hyperlink and think of it as a stream of characters. What you want to do is change part of that stream. The mailmerge field is simply a marker for where you want to insert the new text along with a visual representation that there's something there.

    What you want to replace this visual representation with is a small piece of program code which consists of an opening tag, the program (ie the URL), a visual representation and a closing tag.

    So a solution would be to insert a mailmerge field into normal text and replace it with the full "program code" ie opening tag, url, visual representation, closing tag.

    I don't think its going to be possible to make it look like a URL in the mailmerge field but that's all.

    • Offizieller Beitrag

    WPTools 4 used hidden text to store the URL of a hyperlink. This syntax was used because it was used by the old MS help compiler.

    WPTools5 introduced hyperlink objects which have a URL property (actually "source"). So you can store a function there. In WPTools 4 it would be difficult. You can only use some kind of alias for a longer text stored elsewhere.