COMatePLUS version 1.2

Developed or developing a new product in PureBasic? Tell the world about it.
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 »

That is exactly what we wanted. Give me a minute to finish your code.
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 »

Try the following :

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 »

Yesss ! you have find the beginning 8)
I have a return of the subject, but only the first
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 »

Does each document have multiple subjects or do you mean that you are getting the subject for the first document only?
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 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
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 »

Ah, try changing the debug for a MessageRequester(). I suspect that we may be dealing with a Chr(10) separated list of strings.
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 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
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 »

Difficult for me to assist when I don't have Lotus Notes, but... try the following (I am guessing now) :

REMOVED.
Last edited by srod on Mon Sep 24, 2012 9:23 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 »

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:
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 »

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
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 »

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:
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, 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.
Last edited by srod on Mon Sep 24, 2012 9:55 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 »

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)
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 »

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.
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 »

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
ImageThe happiness is a road...
Not a destination
Post Reply