Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Lotus Script Agent.  No error but doesn't work

Posted on 2008-06-16
14
Medium Priority
?
1,193 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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 400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…

783 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