Domino 9 und frühere Versionen > ND8: Entwicklung

DesignReplace per Knopf

<< < (2/3) > >>

bikerboy:
hmm also mit mit copy und paste funzt es nicht. komme auch leider nicht ganz mit der schreibweise klar.

die art wie er seine Befehle aufbaut.


--- Code: ---'rc% = W32_NSFDbOpen( Tdb$, hdb&amp; )
--- Ende Code ---

so als beispiel. das könnte ich doch noch einfach umgehen indem ich die abfrage über script mache , oder ?


Eigentlich brauche ich doch nur diese Zeile oder ?

--- Code: --- If refreshNow Then
'Initiate refresh immediately...
rc% = W32_DesignRefresh( strSourceServer, hdb&amp;, 0, 0, 0 )
End If

--- Ende Code ---

bikerboy:
@diali

Kann ich mal deinen Code haben ?

diali:
Hier mal der Code den ich verwende. Dieser funktioniert ohne Fehler schon seit Jahren bei uns und bei mehreren tausend Usern.

--- Code: ---Const wAPIModule = "NNOTES"
Const NSF_INFO_SIZE = 128
Const INFOPARSE_DESIGN = 3
Const NOTE_ID_ICON = &HFFFF0010

Declare Private Function DesignRefresh Lib wAPIModule Alias "DesignRefresh" (Byval S As String, Byval hDB As Long, Byval F As Long, Byval zA As Long, Byval zM As Long) As Integer

Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" (Byval zP As Long, Byval S As String, Byval F As String, Byval N As String) As Integer

Declare Private Function NSFDbInfoGet Lib wAPIModule Alias "NSFDbInfoGet" (Byval hDB As Long, Byval D As String) As Integer
Declare Private Sub NSFDbInfoModify Lib wAPIModule Alias "NSFDbInfoModify" (Byval S As String, Byval W As Integer, Byval D As String)
Declare Private Function NSFDbInfoSet Lib wAPIModule Alias "NSFDbInfoSet" (Byval hDB As Long, Byval D As String) As Integer

Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" (Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" (Byval hDB As Long) As Integer

Declare Private Function NSFItemSetText Lib wAPIModule Alias "NSFItemSetText" (Byval hNT As Long, Byval N As String, Byval D As String, Byval nD As Integer) As Integer

Declare Private Function NSFNoteOpen Lib wAPIModule Alias "NSFNoteOpen" (Byval hDB As Long, Byval NoteID As Long, Byval F As Integer, hNT As Long) As Integer
Declare Private Function NSFNoteClose Lib wAPIModule Alias "NSFNoteClose" (Byval hNT As Long) As Integer
Declare Private Function NSFNoteUpdate Lib wAPIModule Alias "NSFNoteUpdate" (Byval hNT As Long, Byval F As Integer) As Integer

Sub Click(Source As Button)
 templateserver$ = "" ' Name des Servers, auf dem sich die Schablone befindet
 templatename$ = "StdR65PersonalAdr" ' Schablonenname
 dbserver$ = "" ' Name des Servers auf dem sich die DB befindet, deren Gestaltung ersetzt werden soll (lokal = "")
 dbfilepath$ = "names.nsf" ' Pfad und Dateiname der DB, bei der die Gestaltung ersetzt werden soll
 
 dp$ = String(1024, " ")
 OSPathNetConstruct 0, dbserver$, dbfilepath$, dp$
 
 Dim hDB As Long
 NSFDbOpen dp$, hDB
 If hDB = 0 Then Exit Sub
 
 d$ = Space(NSF_INFO_SIZE)
 NSFDbInfoGet hDB, d$
 NSFDbInfoModify d$, INFOPARSE_DESIGN, templatename$
 NSFDbInfoSet hDB, d$
 
 Dim hNT As Long
 NSFNoteOpen hDB, NOTE_ID_ICON, 0, hNT
 NSFItemSetText hNT, "$TITLE", d$, Instr(d$, Chr$(0))
 NSFNoteUpdate hNT, 0
 NSFNoteClose hNT
 
 DesignRefresh templateserver$, hDB, 1, 0, 0
 
 NSFDbClose hDB
End Sub
--- Ende Code ---

bikerboy:
HI,

also irgendwas passt hier nicht habe die Code folgendermassen übernommen ;


--- Code: ---Const wAPIModule = "NNOTES"
Const NSF_INFO_SIZE = 128
Const INFOPARSE_DESIGN = 3
Const NOTE_ID_ICON = &HFFFF0010
Const errorString = "Konnte den Pfad zum Notes-Data-Verzeichnis nicht finden. Die Bearbeitung wird abgebrochen"

Declare Private Function DesignRefresh Lib wAPIModule Alias "DesignRefresh" (Byval S As String, Byval hDB As Long, Byval F As Long, Byval zA As Long, Byval zM As Long) As Integer

Declare Private Function OSPathNetConstruct Lib wAPIModule Alias "OSPathNetConstruct" (Byval zP As Long, Byval S As String, Byval F As String, Byval N As String) As Integer

Declare Private Function NSFDbInfoGet Lib wAPIModule Alias "NSFDbInfoGet" (Byval hDB As Long, Byval D As String) As Integer
Declare Private Sub NSFDbInfoModify Lib wAPIModule Alias "NSFDbInfoModify" (Byval S As String, Byval W As Integer, Byval D As String)
Declare Private Function NSFDbInfoSet Lib wAPIModule Alias "NSFDbInfoSet" (Byval hDB As Long, Byval D As String) As Integer

Declare Private Function NSFDbOpen Lib wAPIModule Alias "NSFDbOpen" (Byval P As String, hDB As Long) As Integer
Declare Private Function NSFDbClose Lib wAPIModule Alias "NSFDbClose" (Byval hDB As Long) As Integer

Declare Private Function NSFItemSetText Lib wAPIModule Alias "NSFItemSetText" (Byval hNT As Long, Byval N As String, Byval D As String, Byval nD As Integer) As Integer

Declare Private Function NSFNoteOpen Lib wAPIModule Alias "NSFNoteOpen" (Byval hDB As Long, Byval NoteID As Long, Byval F As Integer, hNT As Long) As Integer
Declare Private Function NSFNoteClose Lib wAPIModule Alias "NSFNoteClose" (Byval hNT As Long) As Integer
Declare Private Function NSFNoteUpdate Lib wAPIModule Alias "NSFNoteUpdate" (Byval hNT As Long, Byval F As Integer) As Integer



--- Ende Code ---


--- Code: ---Sub Click(Source As Button)

Dim s As New NotesSession
Dim ws As New NotesUIWorkspace

Dim dbThis As NotesDatabase

Dim docCurrent As NotesDocument

Dim rtAttachment As  NotesRichTextItem

Dim strPath As String
Dim strKey As String

Set docCurrent = ws.CurrentDocument.Document
strKey = "Directory"

Set rtAttachment = docCurrent.GetFirstItem("body")
If ( rtAttachment.Type = RICHTEXT ) Then
Forall objEmbedded In rtAttachment.EmbeddedObjects
If ( objEmbedded.Type = EMBED_ATTACHMENT ) Then

strPath = s.GetEnvironmentString(strKey,True)

If strPath = "" Then
strKey = "FileDlgDirectory"
strPath = s.GetEnvironmentString(strKey,True)
End If

If strPath = "" Then
Msgbox(errorString)
Exit Sub
End If

If Right(strPath,1) <> "\" Then
strPath = strPath & "\"
End If

If Lcase(Right(strPath,6)) <> "\data\" Then
Msgbox(errorString)
Exit Sub
End If

strPath = strPath & objEmbedded.Source
Call objEmbedded.ExtractFile( strPath )
Exit Forall
End If
End Forall
End If


templateserver$ = ""
templatename$ = "StdR4PersonalAddressBook/de"
dbserver$ = ""
dbfilepath$ = "names.nsf"

dp$ = String(1024, " ")
OSPathNetConstruct 0, dbserver$, dbfilepath$, dp$

Dim hDB As Long
NSFDbOpen dp$, hDB
If hDB = 0 Then Exit Sub

d$ = Space(NSF_INFO_SIZE)
NSFDbInfoGet hDB, d$
NSFDbInfoModify d$, INFOPARSE_DESIGN, templatename$
NSFDbInfoSet hDB, d$

Dim hNT As Long
NSFNoteOpen hDB, NOTE_ID_ICON, 0, hNT
NSFItemSetText hNT, "$TITLE", d$, Instr(d$, Chr$(0))
NSFNoteUpdate hNT, 0
NSFNoteClose hNT

DesignRefresh templateserver$, hDB, 1, 0, 0

NSFDbClose hDB


End Sub

--- Ende Code ---

wenn ich bei der Datenbank angabe eine Datenbank nehme die ich erstellt habe und die kein Design hat, stülpt er das auch rüber aber beim echten Names.nsf nicht , warum

bikerboy:
So ich habe es vermutlich gefunden, wenn man Notes als MultiUserInstallation installiert packt das Setup Programm die Template einmal unter :

C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Lotus\Notes\Data\Shared

C:\Dokumente und Einstellungen\All Users\Anwendungsdaten\Lotus\Notes\Data\Shared\mui\de

ab, wenn man nun den 2. Pfad als Pfadangabe nimmt aktualiesiert er das persönlich Adressbuch

Navigation

[0] Themen-Index

[#] Nächste Seite

[*] Vorherige Sete

Zur normalen Ansicht wechseln