|
CD Chili Code plugin - LotusScript |
|
|
|
Demo for Core Design Chili Code plugin - LotusScript.
%REM
extracted from "OLE constants"
(http://noteslog.com/post/ole-constants/)
%END REM
'Install tlbinf32.dll:
Option Public
Option Declare
Use "RegistryAccess"
Sub Initialize
%INCLUDE "error_handling"
Dim tli As Variant
On Error Resume Next
Set tli = CreateObject( "TLI.TLIApplication" )
On Error Goto HandleError
If Err = 0 Then
Set tli = Nothing
Exit Sub
End If
Dim instalar As String
instalar = "tlbinf32.dll"
Dim s As New NotesSession
Dim db As NotesDatabase
Set db = s.CurrentDatabase
Dim d As notesdocument
Set d = GetHelpAboutDocument( db, instalar )
If d Is Nothing Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be found in the database" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Dim systemRoot As String
systemRoot = RegQueryValue( "HKEY_LOCAL_MACHINE", "SOFTWAREMicrosoftWindows NTCurrentVersion", "SystemRoot" )
Dim path As String
path = systemRoot & "system32" & instalar
Call ExtractAttachment( d, instalar, path )
If Dir( path ) = "" Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be put in the folder " & path & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
If Shell( "regsvr32 /s " & instalar ) 33 Then
Msgbox "The library " & instalar & " has not been installed" & Chr( 10 ) _
& "The library could not be registered" & Chr( 10 ) _
& "Please notify your admin"
Exit Sub
End If
Msgbox "The library " & instalar & " has been installed"
' HKEY_CLASSES_ROOTCLSID{8B217746-717D-11CE-AB5B-D41203C10000}InprocServer32
End Sub
Function GetHelpAboutDocument( db As NotesDatabase, filename As String ) As NotesDocument
%INCLUDE "error_handling"
Dim nc As NotesNoteCollection
Set nc = db.CreateNoteCollection( False )
nc.SelectHelpAbout = True
Call nc.BuildCollection
Dim nid As String
nid = nc.GetFirstNoteId
If nid "" Then
Set GetHelpAboutDocument = db.GetDocumentByID( nid )
Else
Set GetHelpAboutDocument = Nothing
End If
End Function
Sub ExtractAttachment( d As NotesDocument, filename As String, path As String )
%INCLUDE "error_handling"
If Not d.HasEmbedded Then Exit Sub
Dim embedded As NotesEmbeddedObject
Set embedded = d.GetAttachment( filename )
If embedded Is Nothing Then Exit Sub
Call embedded.ExtractFile( path )
End Sub
Article Supporters:
0 (total)
|