OpenNTF.org - LotusScript Button code to vie
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
LotusScript Button code to view Status of Selected Agent in current DB (Great for checking on the Out of Office Agent !) 
Rating:
Rating: 5 , Number of votes: 1 
Contributor:
Donald A Russell 
Category:
Lotusscript 
Type:
Reporting 
Document Release:
1.0 
Notes Version:
R5.x, R6.x 
Last Modified:
24 Aug 2005 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description
Brings up all the agent names in the current database and shows them all in a drop down selection box. After selecting the agent it displays the Last run date & time and agent signer.


Example

Agent Name = Out of Office
Last Run 08/10/2005 13:21:22
Agent Signer = DevSharedID/Company/ORG

Usage / Example
Sub Click(Source As Button)
Dim workspace As New NotesUIWorkspace
Dim session As New NotesSession
Dim db As NotesDatabase
Dim agent As NotesAgent
Dim runDate As Variant
Dim agentName As String

Dim crlf As String
Dim cr As String
Dim lf As String

Dim itms() As String
Dim userchuz As Variant
Dim userchui As Integer


cr$=Chr(13) ' Carriage return
lf$=Chr(10) ' line feed
crlf$=Chr(13) & Chr(10) ' Carriage return/line feed

Set db = session.CurrentDatabase


'-------------------------------------------------------------------------------------------------------------------------------
' Cycle through all the agents in the DB to gather all Agent Names and store in array itms
'-------------------------------------------------------------------------------------------------------------------------------
i =1
Nod = 0 ' Number of Agentss in DB (Initialize)


' Loop to count agents
j=0 ' Initialize Agent counter
Forall a In db.Agents
J=J+1
' End If
End Forall
RDim = j-1
Redim itms(RDim) As String

J=0
Forall a In db.Agents
itms(j) = a.Name
'Set agent = a
J=J+1
End Forall

userchuz = workspace.Prompt(PROMPT_OKCANCELLIST,"In Notes " & DB.Title & " Select the Domino Database Agent from this List", "Please select the Database Agent for last Run Date","", itms) 'Line60
If (userchuz <> "") Then
'Continue
Goto Cont01
Else
'No Choice was made
Exit Sub
End If 'Line 90
Cont01:

'Set agent = agentName
' Now cycle through all the agents and get the choosen one
agentName = Cstr(userchuz)
Forall a In db.Agents
If ( a.Name = userchuz) Then
Set agent = a
AgentSigner = agent.owner
Exit Forall
End If
End Forall



ContRun:
runDate = agent.LastRun


message$ = " The agent name " & agentName & " " & cr$ _
& " Last ran " & runDate & cr$ _
& " Agent Signer " & agentSigner & cr$ & Cr$_
& " Note: 12:00 AM = Agent Never Run " & cr$_
& " Press OK to continue? "
boxType& = 33

answer% = Messagebox(message$, boxType&, _
"In Notes " & DB.Title & " The Domino DB Agent's Last Run Date")
' 1 is the return value for pressing OK
If(answer% = 1) Then
Goto Cont ' OK was pressed so Continue script
Else
Exit Sub ' If another box type is used with a choice, then an alternative path may be taken.
End If
Cont:
End Sub
 Comments

No documents found

 Add your comment!