OpenNTF.org - Clear LotusScript breakpoints
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Clear LotusScript breakpoints for a given database. 
Rating:
Not Rated Yet 
Contributor:
Dallas Gimpel 
Category:
Lotusscript 
Type:
Utilities 
Notes Version:
R6.x, R7.x 
Last Modified:
14 Feb 2007 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description

In my experience, there are instances when the option to persist LotusScript breakpoints results in "orphaned" breakpoints . . . my own as well as those of others. These occur as profile documents in a database. While I'm sure they're harmless enough, they can still be a bit annoying so I wrote this utility to clear them for a given database.
dgg

Sub main()
'// GLOBAL VARIABLES:
'// none
'//
'// 09/22/2005 - Dallas Gimpel
'//
'// DESCRIPTION:
'// Clears all LS breakpoints that have been persisted to a given database.
'//
'// OUTPUT:
'// none

On Error Goto errorHandler

Const PROFILE_NAME = "breakpoints_"
Const PROMPT_CHOOSEDATABASE = 13
Dim wrkspc As NotesUIWorkspace
Dim ndbTarget As NotesDatabase
Dim nclxn As NotesNoteCollection
Dim dclxn As NotesDocumentCollection
Dim docNote As NotesDocument
Dim i As Integer
Dim intCount As Integer
Dim strNoteID As String
Dim varDbSlxn As Variant

Set wrkspc = New NotesUIWorkspace()

varDbSlxn = wrkspc.Prompt(PROMPT_CHOOSEDATABASE, "Select database . . .", "Select the database for which breakpoints are to be cleared.")
If Not(Isarray(varDbSlxn)) Then
Print "Action cancelled . . ."
Goto thisExit
End If

Set ndbTarget = New NotesDatabase(varDbSlxn(0), varDbSlxn(1))
Set nclxn = ndbTarget.CreateNoteCollection(False)
Set dclxn = ndbTarget.GetProfileDocCollection({SNEPNNWEU}) '// that's "some non-existent profile name nobody will ever use"

nclxn.SelectProfiles = True
Call nclxn.BuildCollection()

strNoteID$ = nclxn.GetFirstNoteId()
intCount% = nclxn.Count
For i = 1 To intCount%
Set docNote = ndbTarget.GetDocumentByID(strNoteID$)
If Not(docNote Is Nothing) Then
If Strcompare(docNote.NameOfProfile, PROFILE_NAME, 5) = 0 Then
Call dclxn.AddDocument(docNote)
End If
End If
strNoteID$ = nclxn.GetNextNoteId(strNoteID$)
Next i

intCount% = dclxn.Count
If intCount% > 0 Then
Call dclxn.RemoveAll(True)
Print {Removed } & intCount% & { breakpoint profile documents in database "} & varDbSlxn(2) & {" . . .}
Else
Print {No breakpoint profile documents found in database "} & varDbSlxn(2) & {" . . .}
End If

thisExit:
Exit Sub

errorHandler:
Msgbox "Error " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & ".", , "Error encountered . . ."
Print "Error " & Err & ": " & Error$ & " encountered at line " & Erl & " of " & Getthreadinfo(1) & " . . ."
Resume thisExit
End Sub

Usage / Example
Not much to it really . . . just copy the "main" subroutine above into a button or agent and call it.
 Comments

No documents found

 Add your comment!