Ben Langhinrichs

Photograph of Ben Langhinrichs

E-mail address - Ben Langhinrichs







Recent posts

Thu 10 Jun 2021

Notes 12 without all the blue



Wed 5 May 2021

Pull public data into Notes on the fly



Thu 29 Apr 2021

Archive a Notes DB off-line w/ Field data and active content


August, 2021
SMTWTFS
01 02 03 04 05 06 07
08 09 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

Search the weblog





























Genii Weblog

Syntax color LotusScript and Formula language with Midas

Fri 9 Sep 2005, 04:22 PM



by Ben Langhinrichs
In the midst of testing for Notes/Domino 7, I have been finalizing some new samples for the Midas Rich Text LSX.  One is the Color code LotusScript and Formula language sample, which I use quite often when posting code.  In a self-referential kind of move, here is the code in the Color code LotusScript agent.  Pretty handy for posting samples on forums:


Sub Initialize
   ' *** Domino front-end classes
   Dim ws As New NotesUIWorkspace
   Dim uidoc As NotesUIDocument
 
   ' *** Domino front-end classes
   Dim session As New NotesSession
   Dim db As NotesDatabase
   Dim doc As NotesDocument
   Dim unid As String
   Dim mode As Integer
 
   Dim flag As Variant
   Dim textfrom As String
 
   Set db = session.CurrentDatabase
   Set uidoc = ws.CurrentDocument
   mode = uidoc.EditMode
   Set doc = uidoc.Document
 
   On Error Goto ErrorHandler
   Dim rtitem As New GeniiRTItem
   Dim rtchunk As GeniiRTChunk
 
   ' *** Connect to Body field and perform highlight  ****
   Call rtitem.ConnectBackend(doc.Handle, "Body", False)
 
   rtitem.CacheLinkMatching = True
   If rtitem.IsConnected Then
      If mode Then uidoc.Save
      uidoc.Close
      Set rtchunk = rtitem.DefineChunk("Everything")
      rtchunk.TextWildcards = True      
      rtitem.HighlightFont = "DarkGreen"
      Call rtchunk.HighlightText(|'*|+Chr(0))
 
      rtitem.HighlightFont = "Blue"
      Call rtchunk.HighlightMatching("", db.FilePath, "LotusScript Reserved Words", "ReservedWord", "", "MinLength=2")
      Call rtchunk.HighlightText("=")
      Call rtchunk.HighlightText("(")
      Call rtchunk.HighlightText(")")
      Call rtchunk.HighlightText("&")
      Call rtchunk.HighlightText(",")
      rtitem.Save
      Set uidoc = ws.EditDocument(mode, doc)
   End If
   Exit Sub   
ErrorHandler:
   Print "Error is& Cstr(Err) & "(& Cstr(Error(Err)) & ")"
   Resume Next
End Sub

Copyright 2005 Genii Software Ltd.

What has been said:

No documents found