Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Lotus Script Agent.  No error but doesn't work

Posted on 2008-06-16
14
Medium Priority
?
1,189 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

You’ve got a lotus Domino web server, and you have been told that “leverage browser caching” is a must do. This means that we have to tell the browser everywhere in the web to use cache. In other words, we set (and send) an expiration date in the HT…
IBM Notes offer Encryption feature using which the user can secure its NSF emails or entire database easily. In this section we will discuss about the process to Encrypt Incoming and Outgoing Mails in depth.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

722 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