壹佰网|ERP100 - 企业信息化知识门户

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 9876|回复: 66

[新手上路] LOTUS程序精选

  [复制链接]
发表于 2004/12/8 15:00:59 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622  。

您需要 登录 才可以下载或查看,没有帐号?注册

x
LOTUS程序精选 [转贴]

1、用程序实现星期的转换:

Dim workspace As New NotesUIWorkspace
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Dim dateComposedObj As New NotesDateTime(""
Set uidoc = workspace.CurrentDocument
Set doc = uidoc.Document
dateComposed = doc.DateComposed
thisWeekday = Weekday(dateComposed(0))
Select Case thisWeekday
Case 1 : stringWeekday = "Sunday"
Case 2 : stringWeekday = "Monday"
Case 3 : stringWeekday = "Tuesday"
Case 4 : stringWeekday = "Wednesday"
Case 5 : stringWeekday = "Thursday"
Case 6 : stringWeekday = "Friday"
Case 7 : stringWeekday = "Saturday"
End Select
Messagebox ("This document was composed on a " & stringWeekday)

2、利用程序增加角色:

Dim db As New NotesDatabase ("", Inputbox("Name of database")
Dim dbACL As NotesACL
Dim dbACLEntry As NotesACLEntry
Set dbACL = db.ACL
ename = Inputbox("Name of ACL entry?"
Set dbACLEntry = dbACL.GetEntry(ename)
Call dbACL.AddRole("Role "
Call dbACLEntry.EnableRole("Role"
dbRoles = dbACLEntry.Roles
If Not(Isempty(dbRoles)) Then
Forall dbRole In dbRoles
Messagebox "Role " & dbRole
End Forall
Else
Messagebox "No roles for this ACL entry"
End If
Call dbACL.save

3、用程序删除私有视图:
Dim session As New notessession
Dim db As notesdatabase
Dim doc As notesdocument
Set db=session.currentdatabase
Forall i In db.views
Set doc=db.getDocumentByUNID(v.universalID)
viewflag=doc.getItemvalue("$flags"
If viewflag(0)="pYV" Then
Call i.remove
End If
End Forall

4、用程序打开视图:


Sub Postopen(Source As Notesuidatabase)
        Call Source.OpenView("按时间"
End Sub

5、利用程序选择运行指定代理:


Dim session As New NotesSession
Dim db As NotesDatabase
Dim theAgent As NotesAgent
Dim agentString As String
Set db = session.CurrentDatabase
Forall agent In db.Agents
   agentString = agentString & Chr(10) & agent.Name
End Forall
   Messagebox agentString,, "Agents"
Set theAgent = db.GetAgent(Inputbox("请输入须运行的代理?")
If Not(theAgent Is Nothing) Then
   Call theAgent.Run
Else
   Messagebox "没有选择代理!"
End If


6、显示数据库的管理者:

Dim session As New NotesSession

Dim db As NotesDatabase
Dim db2 As NotesDatabase
Dim dc As NotesDocumentCollection
Dim doc As NotesDocument
Set db = session.CurrentDatabase
print db.managers(0)

7、检验数字域:

Sub Exiting(Source As Field)
Dim w As New notesuiworkspace
Dim doc As notesuidocument
Dim body As Variant

Set doc=w.currentdocument

num=doc.FieldGettext("num"

If Int(num)<0 Then
Messagebox "输入值非法!请输入数字值。"
Call doc.GotoField( "num" )
Exit Sub
End If

End Sub

8、获取系统目录中所有文件:

Dim pathName As String, fileName As String
    pathName$ = "f:\*.*"
    fileName$ = Dir$(pathName$, 0)
   
    Do While fileName$ <> ""
        Print fileName$
        fileName$ = Dir$()
    Loop

9、利用程序获得CGI变量:
Dim session As New NotesSession
Dim doc As NotesDocument
Set doc = session.DocumentContext
Messagebox User = + doc.Remote_User(0)

10、利用程序写记录:

Dim supV As Variant, tailV As Variant
    supV = 456
    tailV = Null
fileNum% = Freefile()
    fileName$= "f:\tttt.txt"
    Open fileName$ For Append As fileNum%
    Write #filenum%, "Testing", 123, supV, tailV
    Close filenum%

公式精选:


1、利用公式引入(GIF)文件:

   @Command([FileImport];"GIF";"c:\\notes\\data\\binary.gif"  
2、利用公式切换ID :

   @Command([useridswitch])切换ID

3、显示工作站的权限:

   @EditECL("server" : "names.nsf"; ""

4、显示存取控制表:

    @Command([FileDatabaseACL])

5、移至文件夹中:

    @PostedCommand([Folder])

6、利用公式晴空垃圾箱:

    @PostedCommand([EmptyTrash])

7、设置文本颜色:

@Command([TextSetFontColor])

三、API程序

Notes API 程 序

1、隐藏Notes的菜单:

Declare Function GetActiveWindow& Lib "User32"()
Declare Function GetMenu% Lib "User32"(Byval jjh&)
Declare Function SetMenu% Lib "User32"(Byval h&,Byval m&)
Dim ActiveWin As Long
ActiveWin=GetActiveWindow()
Dim temp1 As Integer
temp2=GetMenu(ActiveWin)
Call SetMenu(ActiveWin,0)
2、恢复隐藏Notes的菜单:

Declare Function GetActiveWindow& Lib "User32"()
Declare Function GetMenu% Lib "User32"(Byval jjh&)
Declare Function SetMenu% Lib "User32"(Byval h&,Byval m&)
Dim ActiveWin As Long
ActiveWin=GetActiveWindow()
Dim temp1 As Integer
temp2=GetMenu(ActiveWin)
Call SetMenu(ActiveWin,1)

3、设置计算机名称:

Declare Function SetComputerName Lib"kernel32.dll" Alias"SetComputerNameA"(Byval ipcomputername As String)As Long
ipcomputername="my"
temp=SetComputerName(ipcomputername)

4、利用程序获取计算机名称及登陆用户名:

Declare Function GetComputerName Lib "kernel32.dll" Alias "GetComputerNameA" (Byval lpBuffer As String,nSize As Integer)As Long
Declare Function WNetGetUser Lib "mpr.dll" Alias "WNetGetUserA"(Byval t$,Byval ttt$,Byval siz&)As Long
Dim lpBuffer As String
    Dim nSize As Integer
    nSize=48
    Call GetComputerName(lpBuffer,nSize)
    Print tt$
    Dim ttt As String
    Dim t As String
    t=""
    Call WNetGetUser(0,ttt,8)
    Print ttt

5、关闭计算机:

Declare Function ExitWindowsEx Lib "user32" (Byval uFlags As Long, Byval dwReserved As Long) As Long
Const EWX_LOGOFF = 0 &#39;显示“正在关闭计算机”
Const EWX_SHUTDOWN = 1 &#39;显示“您可以正常关闭电源了”
Const EWX_REBOOT = 2 &#39;重新启动
Const EWX_FORCE = 4 &#39;强行关闭所有进程
Const EWX_POWEROFF = 8 &#39;关闭计算机
Const EWX_RESET = EWX_LOGOFF + EWX_FORCE + EWX_REBOOT
Sub Click(Source As Button)
Call ExitWindowsEx(12,0):关闭计算机
End Sub
 楼主| 发表于 2004/12/11 16:18:34 | 显示全部楼层
如果大家感觉这个帖子有用,就顶一下,不用让它沉下去哦。
发表于 2004/12/16 16:28:18 | 显示全部楼层
发表于 2004/12/17 16:54:43 | 显示全部楼层
虽然我还不会,刚刚开始学习,但一定要支持一下
发表于 2004/12/19 00:09:46 | 显示全部楼层
支持..
发表于 2004/12/20 16:34:27 | 显示全部楼层
/欢迎/高兴/鼓励
发表于 2004/12/22 09:49:55 | 显示全部楼层
发表于 2004/12/23 09:43:31 | 显示全部楼层
Thanks a lot!
发表于 2004/12/23 16:27:21 | 显示全部楼层
支持,虽然看不太懂,但是正在努力学习。。。。。
发表于 2004/12/24 08:28:10 | 显示全部楼层
发表于 2004/12/27 15:48:55 | 显示全部楼层
怎么用这些程序呢?
发表于 2004/12/28 18:19:53 | 显示全部楼层
/欢迎
发表于 2004/12/28 18:21:12 | 显示全部楼层
/欢迎
发表于 2005/1/6 15:41:40 | 显示全部楼层
UP!
发表于 2005/1/7 16:26:42 | 显示全部楼层
发表于 2005/1/19 11:07:11 | 显示全部楼层
发表于 2005/1/30 19:59:47 | 显示全部楼层
谢谢大哥!
我正需要这个!
发表于 2005/2/3 11:08:27 | 显示全部楼层
发表于 2005/2/9 22:51:15 | 显示全部楼层
我顶!!!
发表于 2005/2/17 11:10:52 | 显示全部楼层
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|小黑屋|手机版|壹佰网 ERP100 ( 京ICP备19053597号-2 )

Copyright © 2005-2012 北京海之大网络技术有限责任公司 服务器托管由互联互通
手机:13911575376
网站技术点击发送消息给对方83569622   广告&合作 点击发送消息给对方27675401   点击发送消息给对方634043306   咨询及人才点击发送消息给对方138011526

GMT+8, 2025/11/28 23:27 , Processed in 0.031539 second(s), 16 queries , File On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表