Page 18 of 23

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 8:38 pm
by srod
That is exactly what we wanted. Give me a minute to finish your code.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 8:42 pm
by srod
Try the following :

REMOVED.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 8:51 pm
by Kwai chang caine
Yesss ! you have find the beginning 8)
I have a return of the subject, but only the first

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 8:55 pm
by srod
Does each document have multiple subjects or do you mean that you are getting the subject for the first document only?

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:01 pm
by Kwai chang caine
i don't think each document have multiple subjects

In fact when i run the VB code i have exactely the same result in the first line
But with the VB code i have several other lines of subject
Each line is the title of a mail

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:03 pm
by srod
Ah, try changing the debug for a MessageRequester(). I suspect that we may be dealing with a Chr(10) separated list of strings.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:07 pm
by Kwai chang caine
I have replaced the debug by "MessageRequester("", Peeks(bstr, -1, #Pb_unicode))" and i have just one msgbox who appears with the first title of a mail

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:13 pm
by srod
Difficult for me to assist when I don't have Lotus Notes, but... try the following (I am guessing now) :

REMOVED.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:20 pm
by Kwai chang caine
Difficult for me to assist when I don't have Lotus Notes
Yes i know, a little bit of person have LOTUS, and it's not a pleasure to have LOTUS :?
I thanks you again much to try in blind 8)

This time i have always the first title and the second line is several sign =

Code: Select all

=========
I have run the VB code and the second tiltle is not "========="
At my advice you read another thing...but what ???? :shock:

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:29 pm
by srod
Doh... think I have it. We hadn't quite translated your VB code correctly!

Try...

Code: Select all

Protected Sess.COMateObject ;Dim Sess As Object
    Protected DB.COMateObject ;Dim DB As Object
    Protected Flag.i, index, bstr ;Dim flag As Boolean
    Protected *item.VARIANT ;Dim item As Variant
    Protected *sa.SAFEARRAY
    Define.COMateObject Dc
    Define.COMateObject NodeObject
  
      
    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\CreateEnumeration("GetFirstDocument")
     
     If Dc
      
      NodeObject = Dc\GetObjectProperty("GetFirstDocument")
      
      While NodeObject
       
       *item = NodeObject\GetVariantProperty("GetItemValue('Subject')") 
        If *item
          *sa = *item\parray
          If *sa And SafeArrayGetElement_(*sa, @index, @bstr) = #S_OK
            Debug PeekS(bstr, -1, #PB_Unicode)
            SysFreeString_(bstr)
          EndIf
          VariantClear_(*item)
        EndIf 
       NextNodeObject = Dc\GetObjectProperty("GetNextDocument(" + Str(NodeObject) + " as COMateObject)")
       NodeObject\Release()
       NodeObject = NextNodeObject        
      Wend
       
      Dc\Release()
       
     EndIf
                   
     Sess\Release()
     DB\Release()
       
    EndIf

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:42 pm
by Kwai chang caine
Yeeess you are always the more strong !!!
I not offer to you my usual GIF, because i believe they annoy you after all this years :oops:
But believe me, the heart is here 8)

I'm so happy you are here now, we really missed you and scares :shock:

Thanks a lot SROD, and excuse me to always ask to you difficult question :oops:
I wish you the best night of the month :mrgreen:

Thanks also to FALSAM and KIFFI :wink:

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:48 pm
by srod
Kwai, I would say that you were right to try a COMate enumeration in the first instance. Some components though choose not to handle collections the 'standard' automation way (the way that COMate supports) and so if the enumeration fails, then simply switch back to \GetObjectProperty() in place of \CreateEnumeration(), exactly as we did with this example. I have seen this a few times now.

Having said that, I must say that Kiffi had already intimated that the enumeration itself was amiss! Doh! :) Still, we did need to switch to safearrays.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 9:54 pm
by Kwai chang caine
AUTOMATION is really not simple. :(
I know now, it's also possible to enumerate without comate enumeration.
Your COMATE is really also important for me that PB hitself 8)
Like i use all the day VB6, it's very important to can use OLE with PB
You have created a bridge between my two languages :wink:

Again thanks to have spent your precious time for me :oops:
Have a good night, and long life to you 8)

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 10:01 pm
by srod
I disagree, automation is simple. What is often not so simple, however, are the automation components themselves and the way they choose to do things! :)

Mind you, automation with VB will always be simpler than PB/COMate because automation is designed into the core of the language. Things like safearrays are completely hidden from a VB developer and only a compiler/interpreter can do that to the extent that we see with the above VB code.

Re: COMatePLUS version 1.2

Posted: Mon Sep 24, 2012 10:18 pm
by Kwai chang caine
Yes i have understand that when you have learned to me the transfert of safearray to a DLL :oops:
All is hidden in VB, it's good for the simple code, but when you must speaking with low level langage like PB, all need to appears, and it's that the problem

For COMATE often, i say to me, it's simple i begin to write and after i ask to me : "What i must use INVOKE ??? SetProperty ???
At the begining all appears simple and after i use all the functions one after one and never have what i want :oops:

Fortunately you and some members are here for help, but not enough members use AUTOMATION and it's difficult to have help on this subject
In several years there are so much example, that perhaps all the case are show.
But for the time...it's again difficult to understand COMATE, even if you have all do for make it the more simple possible
Never forget, all of us, have not your knowledge :wink: :D