Examples: HotspotText (NotesRichTextDocLink - LotusScript®)

  1. This agent displays the hotspot text of the first doclink in the Body item.
    Sub Initialize
      Dim session As NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim rti As NotesRichTextItem
      Dim rtnav As NotesRichTextNavigator
      Dim rtlink As NotesRichTextDocLink
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      Set doc = dc.GetFirstDocument
      Set rti = doc.GetFirstItem("Body")
      Set rtnav = rti.CreateNavigator
      If Not rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
        Messagebox "No doclinks in Body item",, "No doclinks"
        Exit Sub
      End If
      Set rtlink = rtnav.GetElement
      If rtlink.HotSpotText = "" Then
        Messagebox "Not a hotspot",, "Hotspot text"
      Else
        Messagebox rtlink.HotSpotText,, "Hotspot text"
      End If
    End Sub
  2. This agent changes the hotspot text of the first doclink in the Body item.
    Sub Initialize
      Dim session As NotesSession
      Dim db As NotesDatabase
      Dim dc As NotesDocumentCollection
      Dim doc As NotesDocument
      Dim rti As NotesRichTextItem
      Dim rtnav As NotesRichTextNavigator
      Dim rtlink As NotesRichTextDocLink
      Set session = New NotesSession
      Set db = session.CurrentDatabase
      Set dc = db.UnprocessedDocuments
      Set doc = dc.GetFirstDocument
      Set rti = doc.GetFirstItem("Body")
      Set rtnav = rti.CreateNavigator
      If Not rtnav.FindFirstElement(RTELEM_TYPE_DOCLINK) Then
        Messagebox "No doclinks in Body item",, "No doclinks"
        Exit Sub
      End If
      Set rtlink = rtnav.GetElement
      If rtlink.HotSpotText = "" Then
        Messagebox "Not a hotspot",, "Hotspot text"
      Else
        Messagebox rtlink.HotSpotText,, "Hotspot text"
        txt$ = Inputbox$("New hotspot text")
        If txt$ <> "" Then 
          rtlink.HotSpotText = txt$
          Call doc.Save(True, False)
        End If
      End If
    End Sub