| Sub Initialize() |
| Dim session as new NotesSession |
| Dim db as NotesDatabase |
| Dim LibName as String |
| |
| Set db=session.GetDatabase("server","dbpath",false) |
| LibName="ScriptLib" |
| |
| 'Routine Main von Scriptbibliothek aufrufen |
| Execute GetLibCode(db,LibName) & Chr(10) & {Main} |
| End Sub |
| |
| Function GetLibCode(db As NotesDatabase, LibName As String) As String |
| Dim colNotes As NotesNoteCollection |
| Dim docLib As NotesDocument |
| Dim strCode As String |
| |
| Set colNotes=db.Createnotecollection(False) |
| |
| colNotes.Selectscriptlibraries=True |
| colNotes.Selectionformula={@LowerCase($Title)="} & LCase(LibName) & {"} |
| colNotes.Buildcollection |
| |
| If colNotes.Count=1 Then |
| Set docLib=db.Getdocumentbyid(colNotes.Getfirstnoteid) |
| strCode=docLib.Getitemvalue("$ScriptLib")(0) |
| GetLibCode=ResolveUses(db,strCode) |
| End If |
| End Function |
| |
| Function ResolveUses(db As NotesDatabase, Code As String) As String |
| Dim aryCode As Variant |
| Dim strCodeLine As String |
| Dim strScriptLib As String |
| Dim strCode As String |
| Dim i As Long |
| |
| aryCode=Split(Code,Chr(10)) |
| |
| For i=LBound(aryCode) To UBound(aryCode) |
| strCodeLine=Trim(LCase(aryCode(i))) |
| If Not strCodeLine="" Then |
| If Not InStr(1,Trim(LCase(aryCode(i))),"option ")=1 Then |
| If InStr(1,Trim(LCase(aryCode(i))),"use ")=1 Then |
| strScriptLib=Trim(Right(strCodeLine,Len(strCodeLine)-3)) |
| strScriptLib=Left(strScriptLib,Len(strScriptLib)-1) |
| strScriptLib=Right(strScriptLib,Len(strScriptLib)-1) |
| strCode=strCode & Chr(10) & GetLibCode(db,strScriptLib) |
| Else |
| strCode=strCode & Chr(10) & aryCode(i) |
| End If |
| End If |
| End If |
| Next |
| ResolveUses=strCode |
| End Function |