【发布时间】:2016-07-22 13:16:58
【问题描述】:
嗨朋友们,我对 lotus notes 很陌生,我有一个无法解决的问题。
我在 lotus notes 中创建了一个带有 lotus 脚本的代理,它生成带有查看详细信息的文本文件。
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 时生成的空文件文件永远不会生成。
*谁能帮我编辑这段代码,我需要每天生成简单的空文本文件,我应该在这段代码中编辑所有行*
感谢您的时间和帮助。
【问题讨论】:
-
我不知道你想要什么......如果你想要一个空文件,那么你需要这四行代码(分号是行分隔符),
Set myStream = s.Createstream();Call myStream.Open(filename, "ASCII");Call myStream.Truncate();Call myStream.Close() -
#Torsten 是的,你说得对,我需要通过代理在服务器中创建一个空文件,但是如果我运行代码,我会收到错误,因为 Error -Variant 在第 10 行不包含对象
-
但有一件事是代理正在被触发而没有错误,但文件没有在服务器中创建。特定文件夹中的时间在远程服务器中更改,但该文件夹为空。没有创建文件#Emmanuel @TorstenLink
标签: lotus-notes lotus-domino lotusscript lotus lotus-formula