RE: LotusScript reading files Domino on Linux
"Nur, Mohamed S" <[email protected]> Tue, 19 Dec 2006 10:45:28 +1100
| Newsgroups | gmane.linux.suse.domino |
|---|---|
| Message-ID | <6215401E01247448A306C54F499111F201D05CF8@WSMSG2103V.srv.dir.telstra.com> |
------_=_NextPart_001_01C722FE.995F9A13 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Thanks Rainer.. works fine now...appreciate it =20 Kind Regards, Mohamed Nur =20 ________________________________ From: [email protected] [mailto:[email protected]]=20 Sent: Tuesday, 5 December 2006 9:29 PM To: Nur, Mohamed S Cc: [email protected] Subject: RE: [suse-domino] LotusScript reading files Domino on Linux Hello Mohamed!=20 the command Dir$(...) as you use it, returns a string, not a variant.=20 Your code returns a "type mismatch" error on the line "Forall testfile In varFiles"=20 the following code does work (at least on my Linux box):=20 Sub Initialize=20 Dim session As New NotesSession=20 Dim agentlog As NotesLog=20 Dim iPos As Integer, iPrevPos As Integer=20 Dim sPath As String=20 Dim sFile As String=20 Dim varFiles As Variant=20 =20 On Error Goto Error_Handler=20 sPath =3D "/os_backup/smartplan/" =20 sFile =3D "test.txt"=20 =20 'Check to see if file exists and return results... =20 Set agentlog =3D New NotesLog("Test Filepath")=20 Call agentlog.OpenAgentLog=20 Call agentlog.LogAction("About to test ...")=20 =20 ' varFiles =3D Dir$(sPath, 0)=20 testfile =3D Dir$(sPath, 0)=20 ' Call agentlog.LogAction(testfile)=20 ' Forall testfile In varFiles =20 Do While testfile <> ""=20 Call agentlog.LogAction("Found " & testfile)=20 If testfile =3D sFile Then=20 Call agentlog.LogAction("Found file " & sPath & sFile)=20 Else=20 Call agentlog.LogAction("File " & sPath & sFile & " not found")=20 End If=20 testfile =3D Dir$()=20 Loop=20 ' End Forall=20 =20 Call agentlog.LogAction("Finished")=20 Call agentlog.Close=20 =20 Exit Sub=20 =20 Error_Handler:=20 Call agentlog.LogAction("An error occurred")=20 Call agentlog.LogAction("Error" & Str(Err) & ": " & Error$& " on line " & Cstr(Erl))=20 Call agentlog.LogAction("Finished")=20 Call agentlog.Close=20 Exit Sub=20 End Sub=20 The directory "/os_backup/smartplan/":=20 [notes2: smartplan]$ ls -l=20 total 0=20 -rw-r--r-- 1 notes2 notes 0 Dec 5 11:22 nonsense.txt=20 -rw-r--r-- 1 notes2 notes 0 Dec 5 10:41 test.txt=20 -rw-r--r-- 1 notes2 notes 0 Dec 5 10:41 text.txt=20 Agentlog output:=20 Started running agent 'Chris Test Filepath' on 05.12.2006 11:23:14=20 Running on new or modified documents: 752 total=20 Found 752 document(s) that match search criteria=20 05.12.2006 11:23:14: About to test ...=20 05.12.2006 11:23:14: Found text.txt=20 05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not found=20 05.12.2006 11:23:14: Found test.txt=20 05.12.2006 11:23:14: Found file /os_backup/smartplan/test.txt=20 05.12.2006 11:23:14: Found nonsense.txt=20 05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not found=20 05.12.2006 11:23:14: Finished=20 Ran LotusScript code=20 Done running agent 'Chris Test Filepath' on 05.12.2006 11:23:14=20 Best regards,=20 Rainer=20 "Nur, Mohamed S" <[email protected]>=20 05.12.2006 01:01=20 To <[email protected]>, <[email protected]>=20 cc <[email protected]>=20 Subject RE: [suse-domino] LotusScript reading files Domino on Linux =09 The notes user running the domino task has suffient rights, and this is the log out of the agent.=20 Started running agent 'Chris Test Filepath' on 05/12/2006 09:39:45=20 Running on all documents in database: 90 total=20 Found 90 document(s) that match search criteria=20 05/12/2006 09:39:45: Started=20 05/12/2006 09:39:45: Attempting to open file /os_backup/smartplan/text.txt=20 05/12/2006 09:39:45: Error when attempting to open file /os_backup/smartplan/text.txt=20 Ran LotusScript code=20 Done running agent 'Chris Test Filepath' on 05/12/2006 09:39:45=20 ________________________________ From: [email protected] [mailto:[email protected]]=20 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!=20 Does the Linux user running Domino have sufficient rights on the directory "/os_backup/smartplan/" and the file "test.txt"?=20 Is the "test.txt" file the only file in the directory "/os_backup/smartplan/"?=20 if yes, place more files in the directory and please post the agents agentlog output.=20 Best regards,=20 Rainer Gamauf=20 "Nur, Mohamed S" <[email protected]>=20 04.12.2006 05:07=20 To <[email protected]>=20 cc Subject RE: [suse-domino] LotusScript reading files Domino on Linux =09 Hi having problem running the following scripts in suse linux where it works Fine under windows. Any clues...? The path I have is sPath =3D "/os_backup/smartplan/" =20 sFile =3D "test.txt" Where in windows sPath =3D "c:\os_backup\smartplan\" =20 sFile =3D "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 =20 On Error Goto Error_Handler sPath =3D "/os_backup/smartplan/" =20 sFile =3D "test.txt" =20 'Check to see if file exists and return results... =20 Set agentlog =3D New NotesLog("Test Filepath") Call agentlog.OpenAgentLog Call agentlog.LogAction("About to test ...") =20 varFiles =3D Dir$(sPath, 0) Forall testfile In varFiles Call agentlog.LogAction("Found " & testfile) If testfile =3D sFile Then Call agentlog.LogAction("Found file " & sPath & sFile) Else Call agentlog.LogAction("File " & sPath & sFile & " not found") <=3D=3D I only ever get this message in the agent log End If End Forall =20 Call agentlog.LogAction("Finished") Call agentlog.Close =20 Exit Sub =20 Error_Handler: Call agentlog.LogAction("An error occurred") Call agentlog.LogAction("Finished") Call agentlog.Close Exit Sub --=20 To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] ------_=_NextPart_001_01C722FE.995F9A13 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Dus-ascii"> <META content=3D"MSHTML 6.00.2900.2995" name=3DGENERATOR></HEAD> <BODY> <DIV dir=3Dltr align=3Dleft><SPAN class=3D892574423-18122006><FONT = face=3DArial=20 color=3D#0000ff size=3D2>Thanks Rainer.. works fine now...appreciate=20 it</FONT></SPAN></DIV> <DIV> </DIV><!-- Converted from text/plain format --> <P><FONT size=3D2>Kind Regards,<BR>Mohamed Nur<BR></FONT></P> <DIV> </DIV><BR> <DIV class=3DOutlookMessageHeader lang=3Den-us dir=3Dltr align=3Dleft> <HR tabIndex=3D-1> <FONT face=3DTahoma size=3D2><B>From:</B> [email protected] [mailto:[email protected]] = <BR><B>Sent:</B> Tuesday, 5 December 2006 9:29 PM<BR><B>To:</B> Nur, = Mohamed=20 S<BR><B>Cc:</B> [email protected]<BR><B>Subject:</B> RE: = [suse-domino]=20 LotusScript reading files Domino on Linux<BR></FONT><BR></DIV> <DIV></DIV><BR><FONT face=3Dsans-serif size=3D2>Hello Mohamed!</FONT> = <BR><BR><FONT=20 face=3Dsans-serif size=3D2>the command Dir$(...) as you use it, returns = a string,=20 not a variant.</FONT> <BR><FONT face=3Dsans-serif size=3D2>Your code = returns a "type=20 mismatch" error on the line "</FONT><FONT size=3D2><TT>Forall testfile = In=20 varFiles</TT></FONT><FONT face=3Dsans-serif size=3D2>"</FONT> = <BR><BR><FONT=20 face=3Dsans-serif size=3D2>the following code does work (at least on my = Linux=20 box):</FONT> <BR><FONT size=3D2>Sub Initialize</FONT> <BR><FONT = size=3D2> =20 Dim session As New NotesSession</FONT> <BR><FONT=20 size=3D2> Dim agentlog As NotesLog</FONT> = <BR><FONT=20 size=3D2> Dim iPos As Integer, iPrevPos As=20 Integer</FONT> <BR><FONT size=3D2> Dim sPath = As=20 String</FONT> <BR><FONT size=3D2> Dim sFile = As=20 String</FONT> <BR><FONT size=3D2> Dim = varFiles As=20 Variant</FONT> <BR><FONT size=3D2> = </FONT><BR><FONT=20 size=3D2> On Error Goto Error_Handler</FONT> = <BR><FONT=20 size=3D2> sPath =3D = "/os_backup/smartplan/" =20 </FONT><BR><FONT = size=3D2> =20 sFile =3D "test.txt"</FONT> <BR><FONT = size=3D2> =20 </FONT><BR><FONT size=3D2> 'Check to = see if file=20 exists and return results... = =20 </FONT><BR><FONT size=3D2> Set = agentlog =3D New=20 NotesLog("Test Filepath")</FONT> <BR><FONT size=3D2> = =20 Call agentlog.OpenAgentLog</FONT> <BR><FONT size=3D2> = =20 Call agentlog.LogAction("About to test ...")</FONT> <BR><FONT = size=3D2> =20 </FONT><BR><FONT size=3D2>' =20 varFiles =3D Dir$(sPath, 0)</FONT> <BR><FONT size=3D2> = =20 testfile =3D Dir$(sPath, 0)</FONT> <BR><FONT size=3D2>' = =20 Call agentlog.LogAction(testfile)</FONT> <BR><FONT size=3D2>' = =20 Forall testfile In varFiles = </FONT>=20 <BR><FONT size=3D2> Do While testfile = <>=20 ""</FONT> <BR><FONT size=3D2> = =20 Call agentlog.LogAction("Found " & testfile)</FONT> <BR><FONT = size=3D2> If = testfile =3D=20 sFile Then</FONT> <BR><FONT size=3D2> = =20 Call agentlog.LogAction("Found = file "=20 & sPath & sFile)</FONT> <BR><FONT size=3D2> = =20 Else</FONT> <BR><FONT size=3D2> = =20 Call=20 agentlog.LogAction("File " & sPath & sFile & " not found")=20 </FONT><BR><FONT size=3D2> = =20 End If</FONT> <BR><FONT size=3D2> = =20 testfile =3D Dir$()</FONT> <BR><FONT size=3D2> = =20 Loop</FONT> <BR><FONT size=3D2>' End = Forall</FONT>=20 <BR><FONT size=3D2> </FONT><BR><FONT = size=3D2> =20 Call agentlog.LogAction("Finished")</FONT> = <BR><FONT=20 size=3D2> Call agentlog.Close</FONT> = <BR><FONT=20 size=3D2> </FONT><BR><FONT size=3D2> = =20 Exit Sub</FONT> <BR><FONT size=3D2> =20 </FONT><BR><FONT size=3D2>Error_Handler:</FONT> <BR><FONT = size=3D2> =20 Call agentlog.LogAction("An error occurred")</FONT> = <BR><FONT=20 size=3D2> Call agentlog.LogAction("Error" = &=20 Str(Err) & ": " & Error$& " on line " & = Cstr(Erl))</FONT>=20 <BR><FONT size=3D2> Call=20 agentlog.LogAction("Finished")</FONT> <BR><FONT size=3D2> = =20 Call agentlog.Close</FONT> <BR><FONT size=3D2> = =20 Exit Sub</FONT> <BR><FONT size=3D2>End Sub</FONT> <BR><BR><FONT = face=3Dsans-serif=20 size=3D2>The directory "/os_backup/smartplan/":</FONT> <BR><FONT = size=3D2>[notes2:=20 smartplan]$ ls -l</FONT> <BR><FONT size=3D2>total 0</FONT> <BR><FONT=20 size=3D2>-rw-r--r-- 1 notes2 notes = =20 0 Dec 5 11:22 nonsense.txt</FONT> <BR><FONT = size=3D2>-rw-r--r--=20 1 notes2 notes 0 = Dec=20 5 10:41 test.txt</FONT> <BR><FONT size=3D2>-rw-r--r-- = 1 notes2=20 notes 0 Dec 5 10:41=20 text.txt</FONT> <BR><BR><FONT face=3Dsans-serif size=3D2>Agentlog = output:</FONT>=20 <BR><FONT size=3D2>Started running agent 'Chris Test Filepath' on = 05.12.2006=20 11:23:14</FONT> <BR><FONT size=3D2>Running on new or modified documents: = 752=20 total</FONT> <BR><FONT size=3D2>Found 752 document(s) that match search=20 criteria</FONT> <BR><FONT size=3D2>05.12.2006 11:23:14: About to test = ...</FONT>=20 <BR><FONT size=3D2>05.12.2006 11:23:14: Found text.txt</FONT> <BR><FONT=20 size=3D2>05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not = found</FONT>=20 <BR><FONT size=3D2>05.12.2006 11:23:14: Found test.txt</FONT> <BR><FONT=20 size=3D2>05.12.2006 11:23:14: Found file = /os_backup/smartplan/test.txt</FONT>=20 <BR><FONT size=3D2>05.12.2006 11:23:14: Found nonsense.txt</FONT> = <BR><FONT=20 size=3D2>05.12.2006 11:23:14: File /os_backup/smartplan/test.txt not = found</FONT>=20 <BR><FONT size=3D2>05.12.2006 11:23:14: Finished</FONT> <BR><FONT = size=3D2>Ran=20 LotusScript code</FONT> <BR><FONT size=3D2>Done running agent 'Chris = Test=20 Filepath' on 05.12.2006 11:23:14</FONT> <BR><BR><FONT face=3Dsans-serif=20 size=3D2>Best regards,</FONT> <BR><FONT face=3Dsans-serif = size=3D2> =20 Rainer</FONT> <BR><BR><BR><BR> <TABLE width=3D"100%"> <TBODY> <TR vAlign=3Dtop> <TD width=3D"40%"><FONT face=3Dsans-serif size=3D1><B>"Nur, Mohamed = S"=20 <[email protected]></B> </FONT> <P><FONT face=3Dsans-serif size=3D1>05.12.2006 01:01</FONT> </P> <TD width=3D"59%"> <TABLE width=3D"100%"> <TBODY> <TR> <TD> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>To</FONT></DIV> <TD vAlign=3Dtop><FONT face=3Dsans-serif=20 size=3D1><[email protected]>, = <[email protected]></FONT>=20 <TR> <TD> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>cc</FONT></DIV> <TD vAlign=3Dtop><FONT face=3Dsans-serif=20 size=3D1><[email protected]></FONT>=20 <TR> <TD> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>Subject</FONT></DIV> <TD vAlign=3Dtop><FONT face=3Dsans-serif size=3D1>RE: = [suse-domino]=20 LotusScript reading files Domino on = Linux</FONT></TR></TBODY></TABLE><BR> <TABLE> <TBODY> <TR vAlign=3Dtop> <TD> = <TD></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><BR><BR><FONT = face=3DArial=20 color=3Dblue size=3D2>The notes user running the domino task has = suffient rights,=20 and this is the log out of the agent.</FONT>=20 <P><FONT size=3D3></FONT>=20 <P><FONT size=3D2>Started running agent 'Chris Test Filepath' on = 05/12/2006=20 09:39:45</FONT>=20 <P><FONT size=3D2>Running on all documents in database: 90 total</FONT>=20 <P><FONT size=3D2>Found 90 document(s) that match search criteria</FONT> = <P><FONT size=3D2>05/12/2006 09:39:45: Started</FONT>=20 <P><FONT size=3D2>05/12/2006 09:39:45: Attempting to open file=20 /os_backup/smartplan/text.txt</FONT>=20 <P><FONT size=3D2>05/12/2006 09:39:45: <B>Error when attempting to open = file=20 </B></FONT><FONT color=3Dred = size=3D2><B>/os_backup/smartplan/text.txt</B></FONT>=20 <P><FONT size=3D2>Ran LotusScript code</FONT>=20 <P><FONT size=3D2>Done running agent 'Chris Test Filepath' on 05/12/2006 = 09:39:45</FONT>=20 <P><FONT size=3D3></FONT>=20 <P><FONT size=3D3></FONT>=20 <P><FONT size=3D3></FONT> <BR><BR> <HR> <FONT face=3DTahoma size=3D2><B>From:</B> [email protected]=20 [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>=20 [email protected]<B><BR>Subject:</B> RE: [suse-domino] LotusScript = reading=20 files Domino on Linux</FONT><FONT size=3D3><BR></FONT><BR><FONT = face=3Dsans-serif=20 size=3D2><BR>Hello!</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif = size=3D2><BR>Does the Linux user running Domino have sufficient rights = on the=20 directory </FONT><FONT = size=3D2><TT>"/os_backup/smartplan/"</TT></FONT><FONT=20 face=3Dsans-serif size=3D2> and the file </FONT><FONT=20 size=3D2><TT>"test.txt"</TT></FONT><FONT face=3Dsans-serif = size=3D2>?</FONT><FONT=20 size=3D3> <BR></FONT><FONT face=3Dsans-serif size=3D2><BR>Is the = </FONT><FONT=20 size=3D2><TT>"test.txt"</TT></FONT><FONT face=3Dsans-serif size=3D2> = file the only=20 file in the directory </FONT><FONT=20 size=3D2><TT>"/os_backup/smartplan/"</TT></FONT><FONT face=3Dsans-serif=20 size=3D2>?</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif = size=3D2><BR>if yes,=20 place more files in the directory and please post the agents agentlog=20 output.</FONT><FONT size=3D3> <BR></FONT><FONT face=3Dsans-serif = size=3D2><BR>Best=20 regards,</FONT><FONT size=3D3> </FONT><FONT face=3Dsans-serif = size=3D2><BR>Rainer=20 Gamauf</FONT><FONT size=3D3> <BR><BR><BR></FONT> <TABLE width=3D"100%"> <TBODY> <TR vAlign=3Dtop> <TD width=3D"49%"><FONT face=3Dsans-serif size=3D1><B>"Nur, Mohamed = S"=20 <[email protected]></B> </FONT> <P><FONT face=3Dsans-serif size=3D1>04.12.2006 05:07</FONT><FONT = size=3D3>=20 </FONT></P> <TD width=3D"50%"><BR> <TABLE width=3D"100%"> <TBODY> <TR> <TD width=3D"13%"> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>To</FONT></DIV> <TD vAlign=3Dtop width=3D"86%"><FONT face=3Dsans-serif=20 size=3D1><[email protected]></FONT><FONT size=3D3> = </FONT> <TR> <TD> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>cc</FONT></DIV> <TD vAlign=3Dtop> <TR> <TD> <DIV align=3Dright><FONT face=3Dsans-serif = size=3D1>Subject</FONT></DIV> <TD vAlign=3Dtop><FONT face=3Dsans-serif size=3D1>RE: = [suse-domino]=20 LotusScript reading files Domino on=20 Linux</FONT></TR></TBODY></TABLE><BR><BR> <TABLE width=3D"100%"> <TBODY> <TR vAlign=3Dtop> <TD width=3D"49%"> <TD = width=3D"50%"></TR></TBODY></TABLE><BR></TR></TBODY></TABLE><BR><FONT=20 size=3D3><BR><BR></FONT><FONT size=3D2><TT><BR><BR>Hi having problem = running the=20 following scripts in suse linux where it<BR>works<BR>Fine under=20 windows.<BR><BR>Any clues...? The path I have is<BR><BR>sPath =3D=20 "/os_backup/smartplan/" = =20 <BR> sFile = =3D=20 "test.txt"<BR><BR>Where in windows<BR><BR>sPath =3D = "c:\os_backup\smartplan\"=20 <BR>sFile =3D=20 "test.txt"<BR><BR><BR><BR>Scripts=20 below:<BR><BR>___________________________________________________________= _____________<BR>_____________<BR><BR><BR>Dim=20 session As New NotesSession<BR> = =20 Dim agentlog As NotesLog<BR> = =20 Dim iPos As Integer, iPrevPos As Integer<BR> = =20 Dim sPath As String<BR> = =20 Dim sFile As String<BR> = =20 Dim varFiles As Variant<BR> = =20 <BR> = =20 On Error Goto Error_Handler<BR> = =20 sPath =3D "/os_backup/smartplan/" = =20 <BR> = =20 sFile =3D "test.txt"<BR> = =20 <BR> 'Check to see if file exists and = return=20 results... = <BR> =20 Set agentlog =3D New=20 NotesLog("Test Filepath")<BR> = =20 Call agentlog.OpenAgentLog<BR> = =20 Call agentlog.LogAction("About to test ...")<BR> = =20 <BR> = =20 varFiles =3D Dir$(sPath, 0)<BR> = =20 Forall testfile In varFiles = =20 = =20 <BR> = =20 Call=20 agentlog.LogAction("Found " & testfile)<BR> = =20 = =20 If testfile =3D sFile Then<BR> = =20 = =20 Call=20 agentlog.LogAction("Found file " & sPath &<BR>sFile)<BR> = =20 = =20 Else<BR> = =20 = =20 Call = agentlog.LogAction("File "=20 & sPath & sFile<BR>& " not found") <=3D=3D I = only ever=20 get this message in the agent log<BR> = =20 = End=20 If<BR> End=20 Forall<BR> = <BR> =20 Call=20 agentlog.LogAction("Finished")<BR> = =20 Call agentlog.Close<BR> = =20 <BR> = Exit=20 Sub<BR> =20 <BR>Error_Handler:<BR> = =20 Call agentlog.LogAction("An error occurred")<BR> = =20 Call = agentlog.LogAction("Finished")<BR> =20 Call = agentlog.Close<BR> =20 Exit Sub<BR><BR>-- = <BR>To=20 unsubscribe, e-mail: [email protected]<BR>For additional=20 commands, e-mail: [email protected]</TT></FONT><FONT=20 size=3D3><BR></FONT><BR></BODY></HTML> ------_=_NextPart_001_01C722FE.995F9A13--