返回列表 回复 发帖

LOTUS程序精选

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
如果大家感觉这个帖子有用,就顶一下,不用让它沉下去哦。
虽然我还不会,刚刚开始学习,但一定要支持一下
支持..
/欢迎/高兴/鼓励
Thanks a lot!
支持,虽然看不太懂,但是正在努力学习。。。。。
怎么用这些程序呢?
/欢迎
/欢迎
UP!
谢谢大哥!
我正需要这个!
我顶!!!
谢谢kankan,我保存下来了,以后有类似的帮助新手的信息请多发一些,或者给我介绍一些你的开发经验。谢谢你。



/鼓掌/鼓掌/鼓掌/鼓掌
支持!!!!大家都把自己觉得好的程序添加进来
学习中
/鼓掌hao