Page 17 of 23
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:03 pm
by Kwai chang caine
After a moment i believe i'm alone in the PB world
Thanks to your answer FALSAM

Now i know i'm not invisible
In fact the VB code i give works perfectly, but since two days, i try to enumerate the mail like the VB code do in PB
It's difficult because there are two object DC and DOC
If you have understand a little bit more than me the use of COMATE (It's never difficult to understand better than KCC

) perhaps you have an idea for help me to move a little bit.
The works of SROD is splendid, but not simple to understand how use it

Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:33 pm
by Kiffi
Kwaï chang caïne wrote:without succes

describing, what went wrong, would make it easier for us to help you.
Greetings ... Kiffi
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:33 pm
by srod
Kwai, where is the code failing? Debug some Comate_GetLastErrorDescription() statements.
Must admit that I do not like the look of the statement : Debug NodeObject\GetStringProperty("GetItemValue('Subject')(0)")
This line does not really fit with COMatePLUS. Can you determine if this is the line giving the problem by using Comate_GetLastErrorDescription() etc?
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:33 pm
by Kwai chang caine
Hello SROD and KIFFI
For the moment i have that
But i don't understand why i have an error at the line "result=Query\GetNextObject()"
The Debug COMate_GetLastErrorDescription() not work because i have a pointer to zero at the line "result=Query\GetNextObject()"
Code: Select all
Protected Sess.COMateObject ;Dim Sess As Object
Protected DB.COMateObject ;Dim DB As Object
Protected Dc.COMateObject
Protected Doc.COMateObject
Protected result.COMateObject
Define.COMateEnumObject query
Sess = COMate_CreateObject("Notes.NotesSession") ; Set Sess = CreateObject("Notes.NotesSession")
DB = Sess\GetObjectProperty("GetDatabase('', '')") ; Set DB = Sess.GetDatabase("", "")
DB\Invoke("OPENMAIL") ; DB.OpenMail
flag = #True
If Not DB\GetIntegerProperty("IsOpen") ; If Not (DB.IsOpen) Then
Flag = DB\Invoke("Open('', '')") ; flag = DB.Open("", "")
EndIf
;Debug COMate_GetLastErrorDescription()
If Flag
dc = Db\GetObjectProperty("AllDocuments")
Doc = dc\GetObjectProperty("GetFirstDocument")
Query = doc\CreateEnumeration("GetItemValue('Subject')(0)")
Repeat
result=Query\GetNextObject()
Debug result\GetStringProperty("Items")
Until result\GetStringProperty("Items") = ""
query\release()
DB\release()
doc\release()
dc\release()
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:36 pm
by srod
Kwaï chang caïne wrote:Hello SROD and KIFFI
For the moment i have that
But i don't understand why i have an error at the line "result=Query\GetNextObject()"
I suspect that the enumeration is failing because of the "GetItemValue('Subject')(0)" construct.
You need to put some more error checking in and some of the aformentioned COMate_GetLastErrorDescription() statements.
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:38 pm
by srod
What does the following report?
REMOVED.
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:43 pm
by Kwai chang caine
I have an error null pointer at the line "query\release()"
And the return of error is that :
One or more arguments are invalid. Possibly a numerical overflow or too many nested objects, -if so, try splitting your method call into two or more subcalls.
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:48 pm
by Kiffi
@KCC: i think your enumeration is wrong.
Don't you want to enumerate all
documents?
Code: Select all
Set dc = db.AllDocuments
Set doc = dc.GetFirstDocument
While Not (doc Is Nothing)
[...]
Set doc = dc.GetNextDocument(doc)
Wend
Greetings ... Kiffi
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:51 pm
by Kwai chang caine
In fact i want to have the same thing that with this code of VB
It's the subject i want to enumerate
Code: Select all
Dim Sess As Object
Dim DB As Object
Dim flag As Boolean
Dim dc As Object
Dim Doc As Object
Dim item As Variant
Set Sess = CreateObject("Notes.NotesSession")
Set DB = Sess.GetDatabase("", "")
DB.OpenMail
flag = True
If Not (DB.IsOpen) Then flag = DB.Open("", "")
If flag Then
Set dc = DB.AllDocuments
Set Doc = dc.GetFirstDocument
Do While Not (Doc Is Nothing)
Debug.Print Doc.GetItemValue("Subject")(0)
Set Doc = dc.GetNextDocument(Doc)
Loop
End If
Set Sess = Nothing
Set DB = Nothing
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 7:56 pm
by srod
Kwai, the GetItemValue('Subject') method returns a safearray and so you will need to add some extra code. Let me cobble some code which you can try... (I cannot test the code myself)...
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 8:01 pm
by Kwai chang caine
Thanks a lot SROD, i begin to understand why since all this time nothing works

It's when even crazy that, each time i want to try something, it's never simple

Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 8:12 pm
by srod
Can you run the following and tell me what is debugged? This is just a test.
REMOVED.
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 8:18 pm
by Kwai chang caine
Nothing return because the code not pass the condition "If Dc"
But like it's impossible to know the value of DC with the debugger i suppose Dc = #null
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 8:30 pm
by srod
Try :
REMOVED.
Re: COMatePLUS version 1.2
Posted: Mon Sep 24, 2012 8:36 pm
by Kwai chang caine
The debugger return "8200"