How to parse text from a file and paste results into stationery in Notes 6.5

5 pts.
Tags:
Lotus Notes
Lotus Notes Script
LotusScript
Parsing
Hello, I'm new to Lotusscript and have a question that probably won't be too difficult for a seasoned script writer.

Every day I have to get the first three lines from a log file and paste them into a stationery form and email it out. The log file is a basic text file and the first three lines are short. I usually just copy and paste them into my stationery form and send it out, but if I could use an agent that would save the time of having to ALT-TAB, open file, select text, etc. I used KB shortcuts so it's relatively quick but it does require that I leave notes.

If I could place the cursor in my stationery form then run an agent which grabs those 3 lines and pastes them in it would go really quick. The last line is the timestamp so it's not static text.

Any help would be greatly appreciated.

Answer Wiki

Thanks. We'll let you know when a new response is added.

Something like this should add what you want at the current position of the cursor.
This is an agent code, if added in a button, it should be slightly different : focus would be on the button instead of in the text.
<pre>
Sub Initialize
Dim oSesion As New NotesSession
Dim ouiWS As New NotesUIWorkspace
Dim ouiDoc As NotesUIDocument
Set ouiDoc = ouiWs.CurrentDocument

Const strFileName =”C:\Temp\Toto.txt”

Dim iHandle As Integer
iHandle = Freefile
Open strFileName For Input Shared As iHandle

Dim strline As String
Dim i As Integer
For i =0 To 2
Input #iHandle, strLine
Call ouiDoc.InsertText(strLine)
Call ouiDoc.InsertText(Chr$(10) & Chr$(13))
Next

close iHandle
End Sub
</pre>

Alter the cosntant strFileName to match the path of the file you want to import.
This script is writent for windows (CR+LF), it should be altered for other platform.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following