Passing information about UI objects to a java agent

The lotus java agents don’t have classes to manage the UI objects, such as in LotusScript with the classes NotesUIDocument or NotesUIView.
It’s true that you can find several info about the Notes Client Java UI API in internet, but these classes are not officially supported.
In this post I explain 3 ways to obtain the currently open view or document inside an agent java.
You take advantage of the LotusScript UI classes that can easily manage the UI objects, and you pass them to the java agent using the variables in the notes.ini or a profile document or a notes document.

Sending an e-mail from an other user

If a user sends an e-mail using an agent, he seems to be the sender or the agent signer seems to be the sender if the agent is scheduled.
This is not always the desired behavior, especially in the case of scheduled agents in which the sender of the e-mail seems to be the developer of that agent or the administrator of the server.

Replace a string in the documents in a Lotus database

I think it might be useful to replace each occurrence of a string in all the documents or in the selected documents in a Lotus database, especially when you want to replace a user in the fields author/reader.
The use of roles or groups should be recommended to set the access to the documents, but there may be cases where the user’s name has been used as in Lotus Workflow projects.