RE: LotusScript reading files Domino on Linux
[email protected] Tue, 5 Dec 2006 11:29:22 +0100
| Newsgroups | gmane.linux.suse.domino |
|---|---|
| Message-ID | <[email protected]> |
--=_alternative 00399BDFC125723B_=
Content-Type: text/plain; charset="US-ASCII"
Hello Mohamed!
the command Dir$(...) as you use it, returns a string, not a variant.
Your code returns a "type mismatch" error on the line "Forall testfile In
varFiles"
the following code does work (at least on my Linux box):
Sub Initialize
Dim session As New NotesSession
Dim agentlog As NotesLog
Dim iPos As Integer, iPrevPos As Integer
Dim sPath As String
Dim sFile As String
Dim varFiles As Variant
On Error Goto Error_Handler
sPath = "/os_backup/smartplan/"
sFile = "test.txt"
'Check to see if file exists and return results...
Set agentlog = New NotesLog("Test Filepath")
Call agentlog.OpenAgentLog
Call agentlog.LogAction("About to test ...")
' varFiles = Dir$(sPath, 0)
testfile = Dir$(sPath, 0)
' Call agentlog.LogAction(testfile)
' Forall testfile In varFiles
Do While testfile <> ""
Call agentlog.LogAction("Found " & testfile)
If testfile = sFile Then
Call agentlog.LogAction("Found file " & sPath &
sFile)
Else
Call agentlog.LogAction("File " & sPath & sFile &
" not found")
End If
testfile = Dir$()
Loop
' End Forall
Call agentlog.LogAction("Finished")
Call agentlog.Close
Exit Sub
Error_Handler:
Call agentlog.LogAction("An error occurred")
Call agentlog.LogAction("Error" & Str(Err) & ": " & Error$& " on
line " & Cstr(Erl))
Call agentlog.LogAction("Finished")
Call agentlog.Close
Exit Sub
End Sub
The directory "/os_backup/smartplan/":
[notes2: smartplan]$ ls -l
total 0
-rw-r--r-- 1 notes2 notes 0 Dec 5 11:22 nonsense.txt
-rw-r--r-- 1 notes2 notes 0 Dec 5 10:41 test.txt
-rw-r--r-- 1 notes2 notes 0 Dec 5 10:41 text.txt
Agentlog output:
Started running agent 'Chris Test Filepath' on 05.12.2006 11:23:14
Running on new or modified documents: 752 total
Found 752 document(s) that match search criteria
05.12.2006 11:23:14: About to test ...
05.12.2006 11:23:14: Found text.txt
05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not found
05.12.2006 11:23:14: Found test.txt
05.12.2006 11:23:14: Found file /os_backup/smartplan/test.txt
05.12.2006 11:23:14: Found nonsense.txt
05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not found
05.12.2006 11:23:14: Finished
Ran LotusScript code
Done running agent 'Chris Test Filepath' on 05.12.2006 11:23:14
Best regards,
Rainer
"Nur, Mohamed S" <[email protected]>
05.12.2006 01:01
To
<[email protected]>, <[email protected]>
cc
<[email protected]>
Subject
RE: [suse-domino] LotusScript reading files Domino on Linux
The notes user running the domino task has suffient rights, and this is
the log out of the agent.
Started running agent 'Chris Test Filepath' on 05/12/2006 09:39:45
Running on all documents in database: 90 total
Found 90 document(s) that match search criteria
05/12/2006 09:39:45: Started
05/12/2006 09:39:45: Attempting to open file /os_backup/smartplan/text.txt
05/12/2006 09:39:45: Error when attempting to open file
/os_backup/smartplan/text.txt
Ran LotusScript code
Done running agent 'Chris Test Filepath' on 05/12/2006 09:39:45
From: [email protected] [mailto:[email protected]]
Sent: Monday, 4 December 2006 6:12 PM
To: Nur, Mohamed S
Cc: [email protected]
Subject: RE: [suse-domino] LotusScript reading files Domino on Linux
Hello!
Does the Linux user running Domino have sufficient rights on the directory
"/os_backup/smartplan/" and the file "test.txt"?
Is the "test.txt" file the only file in the directory
"/os_backup/smartplan/"?
if yes, place more files in the directory and please post the agents
agentlog output.
Best regards,
Rainer Gamauf
"Nur, Mohamed S" <[email protected]>
04.12.2006 05:07
To
<[email protected]>
cc
Subject
RE: [suse-domino] LotusScript reading files Domino on Linux
Hi having problem running the following scripts in suse linux where it
works
Fine under windows.
Any clues...? The path I have is
sPath = "/os_backup/smartplan/"
sFile = "test.txt"
Where in windows
sPath = "c:\os_backup\smartplan\"
sFile = "test.txt"
Scripts below:
________________________________________________________________________
_____________
Dim session As New NotesSession
Dim agentlog As NotesLog
Dim iPos As Integer, iPrevPos As Integer
Dim sPath As String
Dim sFile As String
Dim varFiles As Variant
On Error Goto Error_Handler
sPath = "/os_backup/smartplan/"
sFile = "test.txt"
'Check to see if file exists and return results...
Set agentlog = New NotesLog("Test Filepath")
Call agentlog.OpenAgentLog
Call agentlog.LogAction("About to test ...")
varFiles = Dir$(sPath, 0)
Forall testfile In varFiles
Call agentlog.LogAction("Found " &
testfile)
If testfile = sFile Then
Call
agentlog.LogAction("Found file " & sPath &
sFile)
Else
Call
agentlog.LogAction("File " & sPath & sFile
& " not found") <== I only ever get this message in the agent log
End If
End Forall
Call agentlog.LogAction("Finished")
Call agentlog.Close
Exit Sub
Error_Handler:
Call agentlog.LogAction("An error occurred")
Call agentlog.LogAction("Finished")
Call agentlog.Close
Exit Sub
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
--=_alternative 00399BDFC125723B_=
Content-Type: text/html; charset="US-ASCII"
<br><font size=2 face="sans-serif">Hello Mohamed!</font>
<br>
<br><font size=2 face="sans-serif">the command Dir$(...) as you use it,
returns a string, not a variant.</font>
<br><font size=2 face="sans-serif">Your code returns a "type mismatch"
error on the line "</font><font size=2><tt>Forall testfile In varFiles</tt></font><font size=2 face="sans-serif">"</font>
<br>
<br><font size=2 face="sans-serif">the following code does work (at least
on my Linux box):</font>
<br><font size=2>Sub Initialize</font>
<br><font size=2> Dim session As New
NotesSession</font>
<br><font size=2> Dim agentlog As NotesLog</font>
<br><font size=2> Dim iPos As Integer,
iPrevPos As Integer</font>
<br><font size=2> Dim sPath As String</font>
<br><font size=2> Dim sFile As String</font>
<br><font size=2> Dim varFiles As Variant</font>
<br><font size=2> </font>
<br><font size=2> On Error Goto Error_Handler</font>
<br><font size=2> sPath = "/os_backup/smartplan/"
</font>
<br><font size=2> sFile = "test.txt"</font>
<br><font size=2> </font>
<br><font size=2> 'Check to see if file exists and return
results...
</font>
<br><font size=2> Set agentlog = New
NotesLog("Test Filepath")</font>
<br><font size=2> Call agentlog.OpenAgentLog</font>
<br><font size=2> Call agentlog.LogAction("About
to test ...")</font>
<br><font size=2> </font>
<br><font size=2>' varFiles = Dir$(sPath,
0)</font>
<br><font size=2> testfile = Dir$(sPath,
0)</font>
<br><font size=2>' Call agentlog.LogAction(testfile)</font>
<br><font size=2>' Forall testfile In
varFiles </font>
<br><font size=2> Do While testfile
<> ""</font>
<br><font size=2>
Call agentlog.LogAction("Found " & testfile)</font>
<br><font size=2>
If testfile = sFile Then</font>
<br><font size=2>
Call agentlog.LogAction("Found
file " & sPath & sFile)</font>
<br><font size=2>
Else</font>
<br><font size=2>
Call agentlog.LogAction("File
" & sPath & sFile & " not found") </font>
<br><font size=2>
End If</font>
<br><font size=2>
testfile = Dir$()</font>
<br><font size=2> Loop</font>
<br><font size=2>' End Forall</font>
<br><font size=2> </font>
<br><font size=2> Call agentlog.LogAction("Finished")</font>
<br><font size=2> Call agentlog.Close</font>
<br><font size=2> </font>
<br><font size=2> Exit Sub</font>
<br><font size=2> </font>
<br><font size=2>Error_Handler:</font>
<br><font size=2> Call agentlog.LogAction("An
error occurred")</font>
<br><font size=2> Call agentlog.LogAction("Error"
& Str(Err) & ": " & Error$& " on line "
& Cstr(Erl))</font>
<br><font size=2> Call agentlog.LogAction("Finished")</font>
<br><font size=2> Call agentlog.Close</font>
<br><font size=2> Exit Sub</font>
<br><font size=2>End Sub</font>
<br>
<br><font size=2 face="sans-serif">The directory "/os_backup/smartplan/":</font>
<br><font size=2>[notes2: smartplan]$ ls -l</font>
<br><font size=2>total 0</font>
<br><font size=2>-rw-r--r-- 1 notes2 notes
0 Dec 5 11:22 nonsense.txt</font>
<br><font size=2>-rw-r--r-- 1 notes2 notes
0 Dec 5 10:41 test.txt</font>
<br><font size=2>-rw-r--r-- 1 notes2 notes
0 Dec 5 10:41 text.txt</font>
<br>
<br><font size=2 face="sans-serif">Agentlog output:</font>
<br><font size=2>Started running agent 'Chris Test Filepath' on 05.12.2006
11:23:14</font>
<br><font size=2>Running on new or modified documents: 752 total</font>
<br><font size=2>Found 752 document(s) that match search criteria</font>
<br><font size=2>05.12.2006 11:23:14: About to test ...</font>
<br><font size=2>05.12.2006 11:23:14: Found text.txt</font>
<br><font size=2>05.12.2006 11:23:14: File /os_backup/smartplan/test.txt
not found</font>
<br><font size=2>05.12.2006 11:23:14: Found test.txt</font>
<br><font size=2>05.12.2006 11:23:14: Found file /os_backup/smartplan/test.txt</font>
<br><font size=2>05.12.2006 11:23:14: Found nonsense.txt</font>
<br><font size=2>05.12.2006 11:23:14: File /os_backup/smartplan/test.txt
not found</font>
<br><font size=2>05.12.2006 11:23:14: Finished</font>
<br><font size=2>Ran LotusScript code</font>
<br><font size=2>Done running agent 'Chris Test Filepath' on 05.12.2006
11:23:14</font>
<br>
<br><font size=2 face="sans-serif">Best regards,</font>
<br><font size=2 face="sans-serif"> Rainer</font>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>"Nur, Mohamed S"
<[email protected]></b> </font>
<p><font size=1 face="sans-serif">05.12.2006 01:01</font>
<td width=59%>
<table width=100%>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td valign=top><font size=1 face="sans-serif"><[email protected]>,
<[email protected]></font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top><font size=1 face="sans-serif"><[email protected]></font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">RE: [suse-domino] LotusScript
reading files Domino on Linux</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 color=blue face="Arial">The notes user running the domino
task has suffient rights, and this is the log out of the agent.</font>
<p><font size=3> </font>
<p><font size=2>Started running agent 'Chris Test Filepath' on 05/12/2006
09:39:45</font>
<p><font size=2>Running on all documents in database: 90 total</font>
<p><font size=2>Found 90 document(s) that match search criteria</font>
<p><font size=2>05/12/2006 09:39:45: Started</font>
<p><font size=2>05/12/2006 09:39:45: Attempting to open file /os_backup/smartplan/text.txt</font>
<p><font size=2>05/12/2006 09:39:45: <b>Error when attempting to open file
</b></font><font size=2 color=red><b>/os_backup/smartplan/text.txt</b></font>
<p><font size=2>Ran LotusScript code</font>
<p><font size=2>Done running agent 'Chris Test Filepath' on 05/12/2006
09:39:45</font>
<p><font size=3> </font>
<p><font size=3> </font>
<p><font size=3> </font>
<br>
<br>
<hr><font size=2 face="Tahoma"><b>From:</b> [email protected] [mailto:[email protected]]
<b><br>
Sent:</b> Monday, 4 December 2006 6:12 PM<b><br>
To:</b> Nur, Mohamed S<b><br>
Cc:</b> [email protected]<b><br>
Subject:</b> RE: [suse-domino] LotusScript reading files Domino on Linux</font><font size=3><br>
</font>
<br><font size=2 face="sans-serif"><br>
Hello!</font><font size=3> </font><font size=2 face="sans-serif"><br>
Does the Linux user running Domino have sufficient rights on the directory
</font><font size=2><tt>"/os_backup/smartplan/"</tt></font><font size=2 face="sans-serif">
and the file </font><font size=2><tt>"test.txt"</tt></font><font size=2 face="sans-serif">?</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Is the </font><font size=2><tt>"test.txt"</tt></font><font size=2 face="sans-serif">
file the only file in the directory </font><font size=2><tt>"/os_backup/smartplan/"</tt></font><font size=2 face="sans-serif">?</font><font size=3>
</font><font size=2 face="sans-serif"><br>
if yes, place more files in the directory and please post the agents agentlog
output.</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Best regards,</font><font size=3> </font><font size=2 face="sans-serif"><br>
Rainer Gamauf</font><font size=3> <br>
<br>
<br>
</font>
<table width=100%>
<tr valign=top>
<td width=49%><font size=1 face="sans-serif"><b>"Nur, Mohamed S"
<[email protected]></b> </font>
<p><font size=1 face="sans-serif">04.12.2006 05:07</font><font size=3>
</font>
<td width=50%>
<br>
<table width=100%>
<tr>
<td width=13%>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td width=86% valign=top><font size=1 face="sans-serif"><[email protected]></font><font size=3>
</font>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td valign=top>
<tr>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td valign=top><font size=1 face="sans-serif">RE: [suse-domino] LotusScript
reading files Domino on Linux</font></table>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=49%>
<td width=50%></table>
<br></table>
<br><font size=3><br>
<br>
</font><font size=2><tt><br>
<br>
Hi having problem running the following scripts in suse linux where it<br>
works<br>
Fine under windows.<br>
<br>
Any clues...? The path I have is<br>
<br>
sPath = "/os_backup/smartplan/"
<br>
sFile = "test.txt"<br>
<br>
Where in windows<br>
<br>
sPath = "c:\os_backup\smartplan\"
<br>
sFile = "test.txt"<br>
<br>
<br>
<br>
Scripts below:<br>
<br>
________________________________________________________________________<br>
_____________<br>
<br>
<br>
Dim session As New NotesSession<br>
Dim agentlog As
NotesLog<br>
Dim iPos As Integer,
iPrevPos As Integer<br>
Dim sPath As String<br>
Dim sFile As String<br>
Dim varFiles As
Variant<br>
<br>
On Error Goto Error_Handler<br>
sPath = "/os_backup/smartplan/"
<br>
sFile = "test.txt"<br>
<br>
'Check to see if file exists and return results...
<br>
Set agentlog =
New NotesLog("Test Filepath")<br>
Call agentlog.OpenAgentLog<br>
Call agentlog.LogAction("About
to test ...")<br>
<br>
varFiles = Dir$(sPath,
0)<br>
Forall testfile
In varFiles
<br>
Call agentlog.LogAction("Found
" & testfile)<br>
If testfile = sFile Then<br>
Call agentlog.LogAction("Found file "
& sPath &<br>
sFile)<br>
Else<br>
Call agentlog.LogAction("File " &
sPath & sFile<br>
& " not found") <== I only ever get this message
in the agent log<br>
End If<br>
End Forall<br>
<br>
Call agentlog.LogAction("Finished")<br>
Call agentlog.Close<br>
<br>
Exit Sub<br>
<br>
Error_Handler:<br>
Call agentlog.LogAction("An
error occurred")<br>
Call agentlog.LogAction("Finished")<br>
Call agentlog.Close<br>
Exit Sub<br>
<br>
-- <br>
To unsubscribe, e-mail: [email protected]<br>
For additional commands, e-mail: [email protected]</tt></font><font size=3><br>
</font>
<br>
--=_alternative 00399BDFC125723B_=--