A
VladSh, я может ошибаюсь, но replace design скриптово невозможно выполнить....код для ... Replace Design
почему это?replace design скриптово невозможно выполнить
Declare Function W32_NSFDbOpen Lib "nnotes.dll" Alias "NSFDbOpen" _
( Byval dbName As String, hdb As Long ) As Integer
Declare Function W32_NSFDbClose Lib "nnotes.dll" Alias "NSFDbClose" _
( Byval hdb As Long ) As Integer
Declare Function W32_NSFDbInfoGet Lib "nnotes.dll" Alias "NSFDbInfoGet" _
(Byval hdb As Long, Byval dbInfo As String ) As Integer
Declare Sub W32_NSFDbInfoModify Lib "nnotes.dll" Alias "NSFDbInfoModify" _
(Byval dbInfo As String, Byval what As Long, Byval newValue As String )
Declare Function W32_NSFDbInfoSet Lib "nnotes.dll" Alias "NSFDbInfoSet" _
(Byval hdb As Long, Byval dbInfo As String ) As Integer
Declare Function W32_DesignRefresh Lib "nnotes.dll" Alias "DesignRefresh" _
(Byval sourceServer As String, Byval hDb As Long, Byval dwFlags As Long, _
Byval null0 As Long, Byval null1 As Long) As Integer
And a function to call the replace design:
Function designReplace( strTargetServer As String, _
strTargetFile As String, strTemplateName As String, _
strSourceServer As String, refreshNow As Integer) As Integer
'strTargetServer is the server where the database to get new desig resides
'strTargetFile is the database
'strSourceServer is the server where the design is refreshed from
'refreshNow = True, starts refresh right away, otherwise youll have to wait
'for the server or do it manually.
designReplace = False
Dim Sdb As String
Dim Tdb As String
Dim hdb As Long
Dim strDbInfo As String * 255
Dim strDBtitle As String * 255
Dim strDBtemplate As String * 255
Dim rc As Integer
Dim Force As Integer
'*** Build the path for target databases.
If strTargetServer = "" Then
Tdb$ = strTargetFile
Else
Tdb$ = strTargetServer & "!!" & strTargetFile
End If
'*** Get the db info from target database
rc% = W32_NSFDbOpen( Tdb$, hdb& )
If rc% <> 0 Then
'Error opening target database
Exit Function
End If
rc% = W32_NSFDbInfoGet( hdb&;, strDbInfo )
If rc% <> 0 Then
'Error retrieving database info
Exit Function
End If
Call W32_NSFDbInfoModify( strDbInfo, 3, strTemplateName )
rc% = W32_NSFDbInfoSet( hdb&, strDbInfo )
If rc% <> 0 Then
'Error setting new design info
Exit Function
End If
If refreshNow Then
'Initiate refresh immediately...
rc% = W32_DesignRefresh( strSourceServer, hdb&, 0, 0, 0 )
End If
rc% = W32_NSFDbClose( hdb& )
designReplace = True
End Function
Sub ReplaceDesign(Byval templateDB As String, Byval targetDB As String)
Dim status As Long
Dim source As String
Dim target As String
Dim htemplate As Long
Dim htarget As Long
status = NSFDbOpen(templateDB, htemplate)
If status<>0 Then
Print "Can't open template." & templateDB
Exit Sub
End If
status = NSFDbOpen(targetDB, htarget)
If status<>0 Then
Print "Can't open database. " & targetDB
Call NSFDbClose(htemplate)
Exit Sub
End If
Call W32_DesignReplace(htemplate, htarget, 1, 0, 0, 0)
Call NSFDbClose(htemplate)
Call NSFDbClose(htarget)
End Sub
Можно глянуть объявление этой ф-ии?Call W32_DesignReplace(htemplate, htarget, 1, 0, 0, 0)
а почему не использовать штатные механизмы:
- design
- convert
load convert -d doclibrary\ *.nsf newtemplatename
Взломай свой первый сервер и прокачай скилл — Начни игру на HackerLab