Wednesday, March 4, 2009

Lotus Notes - Creating an Agent


Personally I hate lotus notes. But then again, i do not like to live without tinkering with stuff to supposedly automate things. Hence, recently i tried to do something which i had done earlier with OUTLOOK

This is basically an automation which will keep changing the quote in your email. So each time i send an email a new quote gets attached to it. The logic is pretty much simple. Here are the steps that i followed to do this in lotus.
  1. First create a list of quotes; that is the basic ingredient
  2. Create A html file with the quote place in the appropriate place. Like in my case the quote appears in bold at the end of the email signature in the email.
  3. Third, add this signature to your email. This can be easily done by just going to preferences, and selected the appropriate HTML file as you
  4. Now starts the real fun. Create a new "Agent". As per lotus notes help, agents are the means by which we can automate small time tasks. We shall use this to do our signature_upadater as i call it.
  5. Give the agent a name and then select private.Note that in Lotus the menu keeps changing based on what you are looking at. So to be able to get the create menu you should have your inbox opened.Next what you need to do is write some code.
  6. I have a schedule based signal changer.My agent runs every 1 hour and updates the signature. This means every hour I have a new quote in the signature.
  7. You can start with a few declarations like i have here. I assign values to these globals in the init routine.
Dim G_fileNum As Integer Dim C_filePath As String Dim C_signatureFilePath As String Dim C_maxFileLines As Integer

7. Now the idea is that every time the agent runs it will go an update the html file, so that next time you read a memo is
created it will automatically have a new quote. To do this i have created a function that look like this

This function searches a random quote ( i call it quips) from the file whose name is stored in C_FilePath and returns it.
I am a lousy coder...so i have got this to run...but i am sure there are a 100 better ways of doing this.


8.
The GetQuip function is invoked from the main routine. It updates the HTML. Since, this is also similar to the previous code, i will not bore you by posting it.


At the end make sure that you choose where this agent runs. I have chosen it to run on local so that it is not really all that slow. I am not sure if i can get it running on server due to security polices and also because this is not a shared agent. Thus, I have been successfully replicated the behavior i used to get from Outlook with my signature changer macro :-).

The intention of this post was to just bring awareness about agents and what they can do for you, especially if lotus is killing you :-) ( Like it is doing me!!)








No comments: