codice per visualizzare lo stato di un agente in LS

TIPS DEVELOPERS agent show status esecuzione ls routine agente

  • 0 commenti
Questa routine trovata su OpenNtf.org permette di visuallizare lo stato di un agente presente nel database corrente generando ad esempio
questo output:
====================================
Agent Name = Out of Office
Last Run 08/10/2005 13:21:22
Agent Signer = DevSharedID/Company/ORG
====================================

Riporto qui sotto la routine trovata da inserire in un bottone o action:
**********************************
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
**********************************

0 Commenti:

    Nessun Commento Trovato
Commenta articolo
 

Questo spazio web è stato creato da per un uso pubblico e gratuito. Qualsiasi tipo di collaborazione sarà ben accetta.
Per maggiori informazioni, scrivete a info@dominopoint.it

About Dominopoint
Social
Dominopoint social presence: