Solved

Lotus Script Agent.  No error but doesn't work

Posted on 2008-06-16
14
1,167 Views
Last Modified: 2013-12-18
Hi All,

I attached a small Lotus sript that should save detachments from mails.
The script shows no error messages but it doesn't work unfortunately.

Could you please tell me what's wrong with it?
Thanks,

Agent.txt
0
Comment
Question by:verto33
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 21793617
What does it say in the agent log? check ECL, could it be that agent signer does not have rights to access filesystem?
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21794929
You may need to set the agents privileges (2nd tab, half way) to "2. Allow restricted operations". That will allow reading/writing files to disk.

If it runs scheduled, you'd need privileges for that as well (domino directory, server document, restrictions tab).
0
 

Author Comment

by:verto33
ID: 21802068
The "Set runtime security level" is set to 2
I even tried it with the 3 but no error message and no result.
The laptop user has full access to the D:\Detach folder

It isn't scheduled but Action menu selected.
Do you have any idea what the problem could be?

Where can I find the agent log?
0
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 21803176
Open database in Designer,  within Designer go to agents , (Shared Code - Agents), highlight your agent, then go to the  "agent" menu and select log there
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21806883
Assuming disk access is ok then (i.e. you can write files to D:\Detach yourself as well) and given the fact that you see no errors, my guess would be that the unprocessed search raises a 0-document collection.

Switch the Lotusscript debugger on to see what happens. The Do while-loop may never execute.
Or add a messagebox to display shipping.count before you trigger that loop.
0
 
LVL 2

Expert Comment

by:FormanJackJ
ID: 21817328
I would add PRINT statements to your code so you can see if it is running and the progress of the agent. If you run this agent at the server. the print will show in the server's console & log database.

I looked your agent, and I added PRINT statements to it.
Agent-Rev2.txt
0
 

Author Comment

by:verto33
ID: 21820949
fgrushevsky:
I attached the agent.log

FormanJackJ:
I attached the code to make ou see that one of the printing line gives an error.
I removed this line but then still no error and no saving.
No screen message appeared

CRAK:
I switched on the lotus debugger but it shows no error

Just to be sure I made everything well.
If I open the Agent in the designer I see following:
Document Selection   --empty
(Options)      -empty
(Declarations)      -empty
Initialize       here is the whole code
Terminate      -empty

print-code.doc
agent-log.doc
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 13

Expert Comment

by:CRAK
ID: 21826346
0.name in that line should be o.name
(ie letter "o" next to p instead of number 0)
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21826388
Debugging shows no error, but doet it enter the while loop, or does it jump from "while" straight to wend on its 1st attempt?

That may happen when no docs meet the search criteria.
0
 

Author Comment

by:verto33
ID: 21845700
The debugger jump from the line
Do While Not shippingDoc Is Nothing

directly to the line
End Sub

If e.g. 2 mails are selected with attachments
0
 
LVL 13

Expert Comment

by:CRAK
ID: 21850029
Ok, that what I expected!
That means that the agent did not get any documents... documentcollection is empty (.count=0)

At this time the collection is based on this line:
Set shipping=db.unprocessedSearch({@Contains(@upperCase(Subject);"SHIPPING")},Nothing,0)

The documents returned (according to designer help) are collected must...:
- be considered "unprocessed" by the current agent
- meet the specified search criteria
- were created or modified since the cutoff date

"Unprocessed" depends on what the agent is set to run on (selected docs, all docs in a view etc). You may want to consult designer help for all details.
The cutoff date is set to Nothing in your code, so we can rule that limitation one out already!

That leaves two things for you to look into:
1) What does the agent run on?
2) Do (some of) the selected documents meet the search criterium (i.e. does the Subject field contain "Shipping" (in any case type).

Do let us know (if you don't know how to check, don't be shy!)
0
 

Author Comment

by:verto33
ID: 21853265
Sorry, it was my fault. I didn't realize that the subject doesn't contain the word "Shipping"

I got this code from a colleague and I didn't check the conditions.

Is there a way to remove this condition with the subject? I tried but got errors every time.
Something like replacing shippingDoc with AllDoc or SelectedDoc?
0
 
LVL 13

Accepted Solution

by:
CRAK earned 100 total points
ID: 21864546
So all you really need is the unprocessed document collection?

Sub Initialize

	Dim session As New NotesSession

	Dim db As NotesDatabase

	Dim coll As NotesDocumentCollection

	Dim doc As NotesDocument

	Dim body As NotesRichTextItem

	Dim rtitem As Variant

	

	Dim directory As String

	Dim attachname As String

	Dim filename As String

	Dim oname As String

	

	directory="D:\Detach\"

	

	Set db = session.CurrentDatabase

	Set coll = db.UnprocessedDocuments

	

	Set doc=coll.GetFirstDocument

	Do While Not doc Is Nothing

		

		Set rtitem = doc.GetFirstItem( "Body" )

		Forall o In rtitem.EmbeddedObjects

			oname=directory + o.name	

			Call o.ExtractFile( oname )	

		End Forall

		

		Set doc = coll.GetNextDocument(doc)  

	Loop

End Sub

Open in new window

0
 

Author Comment

by:verto33
ID: 21874404
Thanks for your help. It works perfect.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
Problem "Can you help me recover my changes?  I double-clicked the attachment, made changes, and then hit Save before closing it.  But when I try to re-open it, my changes are missing!"    Solution This solution opens the Outlook Secure Temp Fold…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now