Sonstiges > Offtopic

Entwicklercamp vorbei

<< < (2/2)

eknori:
Hier das Bild der kleinen Leckerei.

http://www.eknori.de/2010-03-14/the-sweetest-dictionary-ever/

Fedaykin:
Hallo Ulrich

Erinnerst Du Dich an meine Idee eine Scriptbibliothek von einer anderen Datenbanken aufzurufen?

Da ich das Gefühl hatte die Idee interessiert Dich, hier mal etwas Code.
Kannst es Dir ja mal anschauen wenn Du Zeit und Interesse hast.

PS: Interessanter wird das ganze natürlich wenn Du mit Use andere ScriptLibs einbindest.  ;)

'TestAgent

--- Code: ---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
--- Ende Code ---

'Beispiel Code für ScriptLib in anderer Datenbank

--- Code: ---Sub Main
Dim session as new NotesSession
Dim db as NotesDatabase

Set db=session.CurrentDatabase

Msgbox "Hallo " & db.Title
End Sub
--- Ende Code ---

Gruss
Remo

DAU-in:
und seit heute weiss ich auch, wo sich der abwesende Dozent in Wirklichkeit rumgetrieben hat:
http://www.spiegel.de/reise/aktuell/0,1518,684565,00.html

Navigation

[0] Themen-Index

[*] Vorherige Sete

Zur normalen Ansicht wechseln