COMatePLUS version 1.2

Developed or developing a new product in PureBasic? Tell the world about it.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post by Kwai chang caine »

After a moment i believe i'm alone in the PB world :(
Thanks to your answer FALSAM 8)
Now i know i'm not invisible :lol:

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 :mrgreen:) 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 :(
ImageThe happiness is a road...
Not a destination
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: COMatePLUS version 1.2

Post by Kiffi »

Kwaï chang caïne wrote:without succes :(
describing, what went wrong, would make it easier for us to help you.

Greetings ... Kiffi
Hygge
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post 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?
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post by Kwai chang caine »

Hello SROD and KIFFI :D
For the moment i have that :oops:
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()
     
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post by srod »

Kwaï chang caïne wrote:Hello SROD and KIFFI :D
For the moment i have that :oops:
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.
I may look like a mule, but I'm not a complete ass.
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post by srod »

What does the following report?

REMOVED.
Last edited by srod on Mon Sep 24, 2012 9:52 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post 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.
ImageThe happiness is a road...
Not a destination
User avatar
Kiffi
Addict
Addict
Posts: 1485
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: COMatePLUS version 1.2

Post 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
Hygge
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post 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
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post 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)...
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post by Kwai chang caine »

Thanks a lot SROD, i begin to understand why since all this time nothing works :cry:
It's when even crazy that, each time i want to try something, it's never simple :oops:
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post by srod »

Can you run the following and tell me what is debugged? This is just a test.

REMOVED.
Last edited by srod on Mon Sep 24, 2012 9:52 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post 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
ImageThe happiness is a road...
Not a destination
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: COMatePLUS version 1.2

Post by srod »

Try :

REMOVED.
Last edited by srod on Mon Sep 24, 2012 9:53 pm, edited 1 time in total.
I may look like a mule, but I'm not a complete ass.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: COMatePLUS version 1.2

Post by Kwai chang caine »

The debugger return "8200"
ImageThe happiness is a road...
Not a destination
Post Reply