没有合适的资源?快使用搜索试试~ 我知道了~
Domino/Lotus Notes常用代码
5星 · 超过95%的资源 需积分: 10 453 下载量 111 浏览量
2007-07-28
18:56:29
上传
评论 2
收藏 56KB DOC 举报
温馨提示
试读
11页
对于那些刚入门,或者熟悉lotus的朋友们想提高自己的水平都是有很大好处的
资源推荐
资源详情
资源评论
lotus notes 常用代码
lotusnotes 常用代码
1.检测当前用户是不是文档的创建者,如果不是,不允许编辑文档。
Sub Querymodechange(Source As Notesuidocument, Continue As Variant)
Dim session As New NotesSession
Dim doc As notesdocument
Dim userName As New NotesName(session.UserName)
Set doc=source.document
If Not ( source.EditMode ) Then
If ( doc.authors(0) = username.CANONICAL ) Then continue=True
Else Msgbox \"您不是此文档的创建人,不可以修改!\",0,\"文档数据库\"
continue=False
End If End If End Sub
2.退出时检测关键的域不能为空
Sub Click(Source As Button)
Dim w As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As notesdocument
Set uidoc=w.currentdocument
name1=uidoc.fieldgettext(\"name\")
If name1=\"\" Then
Messagebox \"姓名不能为空!\",0,\"通讯录\"
Exit Sub
End If
Call uidoc.save
Call uidoc.close
End Sub
3.用私有视图来显示需要当前用户处理的文档,用以下视图公式:
注意建立视图时不要选中\"保存到本地\"选项,否则调试不便.
SELECT Form = \"收文 1\" & NextApprover=@Name([CN];@V3UserName)
4.Notes 中 Active 控件
当文档中添加 OLE 或其他通用的 ActiveX 控件后,在文档的 script 编辑框右侧中,会自动添
加各种属性和方法在 notes 的类列表中.在 script 中声明该对象的 方法如下:
Sub Postopen(Source As Notesuidocument)
Dim w as notesuiworkspace
Dim uidoc as notesuidocument
Dim aa As Variant
Set w =New notesuiworkspace
Set uidoc =w.currentdocument
Set aa=uidoc. getObject(\"Chart\")\'该句为 ole 对象声明,注意 Chart 是你给对象起的名
字 \'接下来你就可以通过 aa.**来调用其方法和属性了.
End Sub
5.以下是 script 错误陷阱代码
Sub subname On Error Goto Errcode \'下面添加你的程序代码
Exit Sub Errcode: Msgbox \"错误 (\" & Cstr(Err) & \" ) -> \" & Error$(Err),16,\"错
误提示\"
Exit Sub
End Sub
6.是否保存
在表单中设定一个域,名称为 saveoption
下列公式添加到返回按钮中,决定文件退出是否保存
FIELD saveoptions:=\"1\"; 保存 FIELD saveoptions:=\"0\"; 不保存
7.用公式弹出对话框,按确定继续,取消返回.
@If(@DialogBox(\"表单名\";[AutoHorzFit]:[AutoVertFit];\"表单标题\");\"\";@Return(\"
\"))
8.用 script 弹出对话框,按确定继续,取消返回
Dim w as notesuiworkspace
If Not w.dialogbox(\"表单名\",True,True,False,True,False,False,\"填写\")
Then doc.close\'用户按取消退出
Exit Sub
End If
9.视图中删除文档语句
@Command([EditClear]);
@Command([ViewRefreshFields])
10.检测是否是周末
Dim dt as notesdatetime
call dt.setnow
If Weekday(dt.lslocaltime)=7
Then\'是周六耶,
dt.adjustday(2) \'加两天到星期一
Elseif Weekday(dt.lslocaltime)=1
Then\'周日加一天
dt.adjustday(1)
End If
11.得到当前的服务器和路径
公式: ResideServer := @Subset(@DbName; 1) ;
CurrentPath := @Subset(@DbName; -1) ;
DirOnly := @If(@Contains(CurrentPath; \"\\\\\");
@LeftBack(CurrentPath; \"\\\\\") + \"\\\\\"; \"\");
DbFile := DirOnly + \"***.NSF\";
12.得到当前用户名
公式 Name([CN];@V3UserName)
script im s as notessession
Dim myname as newnotesname(s.username)
messagebox myname.common
13.得到当前日期公式:
@today @date(@created)
script im dt as notesdatetime
Set dt=New notesdatetime(\"\")
Call dt.setnow
14.常用全局对象声明 \'-----对象变量-----
Dim w As NotesUIWorkspace
Dim s As NotesSession
Dim db As NotesDatabase
Dim view As NotesView
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim item As NotesItem
Dim dt As NotesDateTime
Dim username as notesname
15.一些计算域,开始时没有值,如果不给它一个值会报错,以下公式给计算域赋值
@if(Bfield=\"\";0;Bfield)
16.特殊字符
@char(13)可以在@prompt 提示框中显示回车 script 中用函数 chr(13)
17.怎样判断视图中没有文档?
set doc = vw.getfirstdocument()
if doc is nothing then
.....
end if
18.如何将查询结果放到一个文件夹里?
下面是将搜索结果放到名叫 newfolder 的文件夹中,并跳转到该文件夹上
Sub Click(Source As Button)
Dim docs As notesdocumentcollection
Dim doc As notesdocument
...........
q=doc.query(0)
Set docs = db.ftsearch(q, 0)
Call docs.PutAllInFolder( \"newfolder\" )
Call w.OpenDatabase( \"\",\"\",\"newfolder\")
End Sub
如何删掉数据库中所有私有视图?
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
剩余10页未读,继续阅读
资源评论
- xyzyc2013-10-06还可以,但是需要已经了解notes才行
- gzaapy2015-08-10对刚入们者帮助还是不错!
- colanse2015-03-21还可以,但是需要已经了解notes才行
- c001014842013-08-13非常有参考价值,当看不懂文档的时候
- a0001220072013-03-17还是没有招到入门的内容,不过很感谢
soft110
- 粉丝: 2
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功