Home > Domino Tips > Developer > Agent > Agent Run on Server Tool
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

AGENT

Agent Run on Server Tool


David Peabody
05.05.2003
Rating: -2.75- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


I put together this utility agent for testing and running other agents on the current DB's server. The agent gets the list of agents in the db, sorts them by name, presents the list of alphabetically sorted agents, runs the selected agent on the server, and then provides a message box letting you know if the agent ran successfully or not. I did not create the quicksort routine and, unfortunately, I can't find the name of the person responsible for creating it.



Code

 Declarations
Dim session As NotesSession
Dim ws As NotesUIWorkspace
Dim db As NotesDatabase
Dim agenttorun As NotesAgent
Dim values() As String

Sub Initialize
 Set session = New NotesSession
 Set ws = New NotesUIWorkspace
 Set db = session.CurrentDatabase
 prompttype% = PROMPT_OKCANCELLIST
 title$ = "Agent List"
 prompt$ = "Pick an Agent"
 defaultvalue$ = ""
 count% = Ubound(db.Agents)
 Redim values(count%) As String
 Forall agents In db.Agents
  values(agentcount%) = agents.Name
  agentcount% = agentcount% + 1
 End Forall
 Call quicksort(Lbound(values),Ubound(values),values)
 selectedagent = ws.Prompt( prompttype%, 
title$, prompt$, defaultvalue$,values)
 If Cstr(selectedagent) <> "" Then
  Set agenttorun = db.GetAgent(Cstr(selectedagent))
  
  If agenttorun.RunOnServer = 0 Then
   Messagebox "Agent ran",, "Success"
  Else
   Messagebox "Agent did not run",, "Failure"
  End If
  
 End If
End Sub
Sub quicksort (l As Integer,r As Integer, arrayelts As Variant)  
 Dim m As Variant
 Dim i As Integer
 Dim t As Variant
 Dim j As Integer
 
 If r > l Then              'If there's nothing to sort, jump out
  m = arrayelts(l)      'Initialize boundaries, nominate a 
value to sort
  j = r
  i = l
  
  While (i < j)         'Repeat until i and j "meet in the middle"
   While (arrayelts(i) <= m And i < r)  'Push in the boundaries 
while data is sorted
    i = i + 1
   Wend
   While (arrayelts(j) > m)
    j = j - 1
   Wend
   If i < j  Then   'If there is data between i and j something 
is out of order - swap it
    t = arrayelts(i)
    arrayelts(i) = arrayelts(j)
    arrayelts(j) = t
   End If
  Wend
  
  t = arrayelts(l)       'Swap the nominated and bottom values - 
why we came here
  arrayelts(l) = arrayelts(j)
  arrayelts(j) = t
  Call quicksort (l, j - 1, arrayelts)  'Recurse and sort data either 
side of upper bound
  Call quicksort ((j + 1), r, arrayelts)
 End If
End Sub

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.




Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



RELATED CONTENT
Agent
Run or restart Notes/Domino agents via text messages
Approve Lotus Notes documents using a BlackBerry mobile device
LotusScript agent indexes Lotus Notes/Domino databases
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
How to export data from a Lotus Notes database to a CSV file
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax

Lotus Notes Domino Agents
How the Agent Profiler tool improves Notes/Domino performance
Run or restart Notes/Domino agents via text messages
Calculating results for a column in a Lotus Notes view
Approve Lotus Notes documents using a BlackBerry mobile device
LotusScript agent indexes Lotus Notes/Domino databases
Top 10 Lotus Notes/Domino coding and development tips of 2008
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
Top 10 Lotus Notes Domino programming and development tips of 2007

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary

DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts