嗨朋友我对莲花笔记很新,我有一个我无法解决的查询。
我在Lotus notes中创建了一个带有lotus脚本的代理,它使用View Details生成文本文件。
Option Public
Sub Initialize
MsgBox " Agent AccessUserList"
On Error GoTo HandleError
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim view As NotesView
Dim embobj As NotesEmbeddedObject
Dim rtitem As NotesRichTextItem
Dim ErrMsg As String
Dim dateTime As New NotesDateTime( "" )
dateTime.LSLocalTime = Now
UserListDate = dateTime.DateOnly
TheDate=Format(Now(),"mmdd")
filename = CurDrive$()+"\color\"+"Colors_" +TheDate+"Selection_OP" +".txt"
MsgBox filename
Set db = session.CurrentDatabase
On Error GoTo LogErr
Dim v As NotesView
Dim s As New NotesSession
Dim ec As NotesViewEntryCollection
Dim ent As NotesViewEntry
Dim filePath As String, valString As String
Dim myStream As NotesStream
Dim fileNum As Integer, count As Integer, x As Integer
Set myStream = s.Createstream()
Call myStream.Open(filename, "ASCII")
Call myStream.Truncate()
Set db = s.CurrentDatabase
MsgBox "BEFORE ENTER VIEW"
'Call myStream.Writetext(i.Title, 0)
Set v = db.GetView("SelectCustomer")
MsgBox "Entered View"
If (v Is Nothing) Then
MsgBox "View does not exist"
Exit Sub
End If
count = v.Columncount
ForAll i In v.Columns
If i.Position = count Then
Call myStream.Writetext(i.Title, 0)
Else
Call myStream.Writetext(i.Title & "||")
End If
End ForAll
MsgBox "AFTER COLUMN"
Set ec = v.Allentries
Set ent = ec.Getfirstentry()
While Not ent Is Nothing
x = 1
ForAll j In ent.Columnvalues
If IsArray(j) Then
valString = |"| & Join(j, ",") & |"|
Else
If InStr(j, ",") > 0 Then
valString = |"| & j & |"|
Else
valString = j
End If
End If
If x = count Then
Call myStream.Writetext(valString, 0)
Else
Call myStream.Writetext(valString & "||")
End If
x=x+1
End ForAll
Set ent = ec.Getnextentry(ent)
Wend
closeFile:
Call myStream.Close()
Exit Sub
HandleError:
MsgBox "Error - " & Error &" at line number " & Erl
Exit Sub
LogErr:
Resume closeFile
Exit Sub
End Sub
这是上面的代码,它在服务器中生成带有详细信息的文件。
但我只想要在我在特定文件夹中启动crone时每天生成的空文件我试图删除所有不需要的代码但是如果我评论任何代码我将不会得到错误但是文件永远不会生成。
*任何人都可以帮我编辑这段代码我需要每天生成一个简单的空文本文件,我应该在这段代码中编辑所有行*
感谢您的时间和帮助。
答案 0 :(得分:0)
如果我理解您只想生成一个空文件,请在下面更改代码。我仍然不明白你的尝试和你得到的东西。不要忘记stackoverflow不是雇用自由区的开发人员;-) 下次展示你做了哪些努力!
Option Public
Sub Initialize
On Error GoTo HandleError
Dim session As New NotesSession
dim TheDate as string, filename as string
TheDate=Format(Now(),"mmdd")
filename = CurDrive$()+"\color\Colors_" +TheDate+"Selection_OP.txt"
'MsgBox filename
Dim myStream As NotesStream
Set myStream = s.Createstream()
Call myStream.Open(filename, "ASCII")
Call myStream.Truncate()
Call myStream.Writetext(" ") 'this shouldn't be necessary
closeFile:
Call myStream.Close()
Exit Sub
HandleError:
MsgBox "Error - " & Error &" at line number " & Erl
Exit Sub
End Sub