`

The basic of LotusScript Agent

阅读更多

1、FTSearch搜索:
 Set dc=db.Ftsearch("name",0)  
         '0位置为最大的查询数,0为所有匹配的文件  FTSearch必须创建数据库索引
 Set doc=dc.Getfirstdocument()
2、Item:
 Set doc=dc.Getfirstdocument()
 While Not doc  Is Nothing
   ForAll ritem In doc.Items
      MsgBox ritem.name
   End ForAll
 Wend
3、取出特定的域

Set doc=view.getFirstdocument()
 If doc.HashItem("yu") <> "" Then
    Set item=doc.getfirstitem("yu")
          Set doc=view.getNextdocument(doc)
 End If
4、使用文本属性
If doc.Hashitem("yu") <> ""  Then
 Set doc=dc.Getfirstdocument()
  While Not doc Is  Nothing
    ForAll itemValue In doc.yu
              itemValue = "Anonymous"
          End ForAll   
      Set doc=dc.Getnextdocument(doc)
  Wend
End If
5、获取域值:
   ForAll itemValue In doc.Getitemvalue("yu")
6、添加域
  set item =new NotesItem(doc,"newYu",session.UserName)
  Call doc.Appenditemvalue("newYu",Newvalue)
7、替换值:
  1)、 While Not doc Is Nothing
  Call doc.Replaceitemvalue("resName","newValue")
  Set doc=dc.getnextdocument(doc)
 Wend

   2)、Set doc=dc.Getfirstdocument()
 While Not doc Is Nothing
  'Call doc.Replaceitemvalue("resName","newValue")
  Set item =doc.Getfirstitem("yu")
  While Not item Is Nothing
     ForAll resitems In doc.Itemsv(0)
        resitems="newVlaue"
     End ForAll
     doc.name= doc.Itemsv(0)
     Set item =doc.getnextitem(item)
  Wend
  Set doc=dc.getnextdocument(doc)
 Wend
8、拷贝域
Set item =doc.Getitemvalue("name")
call item.Copyitemtodocument(doc, "name")
call doc.save(true,false)
call doc1.Copyallitems(doc2,true)  ‘替换所有的
9、删除指定的域:
1)、 For j=1 To dc.count
       Set item=doc.Getitemvalue("name")
       Wile Not item Is  Nothing
       Call item.Remove()
       Call doc.Save(true,false)
       Wend
       Set doc=dc.Getnthdocument(j)
       Next
2)、For j=1 To dc.count  
      While Not doc.Hasitem("name")
      Call doc.Removeitem("name")
      Call doc.Save(True,false)
     Wend 
     Set doc=dc.Getnthdocument(j)   
     Next
10、RTF文本域的输出:
     Set item=doc.GetFirstItem("RtfYU")
     MsgBox item.Text
11、在代理中使用公式:

 temp=Evaluate("@ReplaceSubstring(aa;bb;cc)",doc)

12、 嵌入对象:
 ForAll csx In doc.Embeddedobjects
    csx.name
 End ForAll
    Set doc=dc.Getnthdocument(j)
       Next
13、激活嵌入对象:
    Call doc.EmbeddedObjects(0).Activate(True)
14、if的用法
    Set doc=dc.Getfirstdocument()
    If Not IsEmpty(db.Agents) Then
    ForAll agent In db.Agents
     MsgBox agent.name
    End ForAll
     End If

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics