COMate - control COM objects via automation - OBSOLETE!
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Blooming heck Kwai!!!
My advice - take what you've learned about COMate and start translating the code from the beginning. First make sure that the VB code runs okay and then translate the code one line at a time. Test at every stage using the COMate_GetLastErrorDescription() function.
COMate has been so well used now that I don't think that any of the remaining bugs (if any?
) will prevent the successful conversion of what looks to be some quite simple code here.
If this doesn't work then read the COMate manual more carefully.
My advice - take what you've learned about COMate and start translating the code from the beginning. First make sure that the VB code runs okay and then translate the code one line at a time. Test at every stage using the COMate_GetLastErrorDescription() function.
COMate has been so well used now that I don't think that any of the remaining bugs (if any?

If this doesn't work then read the COMate manual more carefully.
I may look like a mule, but I'm not a complete ass.
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Ok Ok, i go to search alone
If i really don't find, i will be back (Like TERMINATOR
)
The VB code works very fine, i'm sure
I wish you a very good day and thanks again for your great works.
For christmas i have a big present for you.
I try to forgot you
*
*
*
*
*
*
*
*
*
*
*
*
*
*
But it's impossible

If i really don't find, i will be back (Like TERMINATOR

The VB code works very fine, i'm sure
I wish you a very good day and thanks again for your great works.
For christmas i have a big present for you.
I try to forgot you

*
*
*
*
*
*
*
*
*
*
*
*
*
*
But it's impossible


Not a destination
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
You are right, i have found the problem.
I believe it's a bad declaration of variable
I have another simple question.
In french the quote character is severaly used.
But when i use it in the line
The subject don't appears
I have try with chr(39) but it's the same problem
Is it normal ??
I mean is because you use the quote for replace the double quote :roll:
Can i circle this problem ???
Thanks for your answer
I believe it's a bad declaration of variable

I have another simple question.
In french the quote character is severaly used.
But when i use it in the line
Code: Select all
SujetMail = "Envoi d'un mail" <---- A quote is present in this line
MailNote\SetProperty("Subject = '" + SujetMail + "'")

I have try with chr(39) but it's the same problem
Is it normal ??
I mean is because you use the quote for replace the double quote :roll:
Can i circle this problem ???
Thanks for your answer

Not a destination
Read the bloody manual you idiot!
In a command string, single quotes are used to signify a string parameter (which COMate needs to identify up front). I used a single quote instead of double quotes to make it easier to use PB's string functions etc.
Now this of course means that we cannot enter any single quotes within our command strings - at least not directly. Because of this COMate allows you to use 'escape codes' of the form $xxxx where xxxx denotes a hexadecimal unicode character code. For single quotes use $0027 (asc code 39).
So your latest code should read :
Now, any more problems and you know what to read first before hitting the post button! 

In a command string, single quotes are used to signify a string parameter (which COMate needs to identify up front). I used a single quote instead of double quotes to make it easier to use PB's string functions etc.
Now this of course means that we cannot enter any single quotes within our command strings - at least not directly. Because of this COMate allows you to use 'escape codes' of the form $xxxx where xxxx denotes a hexadecimal unicode character code. For single quotes use $0027 (asc code 39).
So your latest code should read :
Code: Select all
SujetMail = "Envoi d$0027un mail" <---- A quote is present in this line
MailNote\SetProperty("Subject = '" + SujetMail + "'")

I may look like a mule, but I'm not a complete ass.
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Idiot
I have the same name in french, it's strange no
Excuse me, master SROD
I'm a bad PADAWAN
My problem, it's not that i don't want read your doc.
I know that a doc is very hard to create.
And the IDIOT like me, don't take the time to read it
But i have just do 2 years of english, there are 30 years ago.
It's very very very hard for me to understand the english when it talk of the sun and the rain.
But when it talk of technical language, in a line i don't understand.
Excuse me again for disturb you, but you are my hero, with the other CAID member of this forum.
And if a day you can speak with your hero .....the real batman, or GOD, or Daredevil, spiderman, .........
What is your choice ????
Talk with your dream for example SPIDERMAN or read "STRANGE" the book who he is painted
All the hero have his "ball and chain".
You have found your first
Don't missing, i respect you and the forum member very much
I have just a little head, without brain
My mother have no cliked the option when she create me.
I do without, it's difficult, but i fight this all the day.
Again thanks, for your kind answer, and your patience
If you travel in france, I give you a meal
It's the minimal that i can do for you
The IDIOTMAN (Cool name :roll:)
Now, thanks SROD, me too i have a super hero name

I have the same name in french, it's strange no

Excuse me, master SROD
I'm a bad PADAWAN

My problem, it's not that i don't want read your doc.
I know that a doc is very hard to create.
And the IDIOT like me, don't take the time to read it

But i have just do 2 years of english, there are 30 years ago.
It's very very very hard for me to understand the english when it talk of the sun and the rain.
But when it talk of technical language, in a line i don't understand.

Excuse me again for disturb you, but you are my hero, with the other CAID member of this forum.
And if a day you can speak with your hero .....the real batman, or GOD, or Daredevil, spiderman, .........
What is your choice ????
Talk with your dream for example SPIDERMAN or read "STRANGE" the book who he is painted

All the hero have his "ball and chain".
You have found your first

Don't missing, i respect you and the forum member very much

I have just a little head, without brain
My mother have no cliked the option when she create me.
I do without, it's difficult, but i fight this all the day.
Again thanks, for your kind answer, and your patience

If you travel in france, I give you a meal
It's the minimal that i can do for you

The IDIOTMAN (Cool name :roll:)
Now, thanks SROD, me too i have a super hero name


Not a destination
hehe, you are one funny guy Kwai - even if I don't understand half of what you say!!!
I take your point though about trying to read a technical guide in English - aye that's fair enough!
I have the same problem when I look at my car repair guide - even though it's written in English it may as well be in Swahili!!!! I mean, what the hell is an engine dipstick? I though a dipstick was that guy who lives in Australia and goes by the name of Fangbeast!!!
Kwai, I think we should start a separate thread titled "Kwai chang caine's coding questions!" where you can post away! Better still, perhaps one of the mods will open up a new forum section just for you?
hehe. Only kidding.

I take your point though about trying to read a technical guide in English - aye that's fair enough!


Kwai, I think we should start a separate thread titled "Kwai chang caine's coding questions!" where you can post away! Better still, perhaps one of the mods will open up a new forum section just for you?
hehe. Only kidding.
I may look like a mule, but I'm not a complete ass.
- Fangbeast
- PureBasic Protozoa
- Posts: 4789
- Joined: Fri Apr 25, 2003 3:08 pm
- Location: Not Sydney!!! (Bad water, no goats)
Kwai, don't bother asking that short assed, runty, bow legged, cave dwelling, g-string sniffing, car crashing, dog reaming hamster botherer srod anything else because I have to kill him again. Third time this month damn it!!
Come to think of it, his festering, steaming, decayed carcass smells like fertiliser already because of what he keeps doing to his own dipstick. You know, that 3 inch one on his finger!!!
MWUAHAHAHAHAHAHA!
Come to think of it, his festering, steaming, decayed carcass smells like fertiliser already because of what he keeps doing to his own dipstick. You know, that 3 inch one on his finger!!!
MWUAHAHAHAHAHAHA!
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Oooohh like meeven if I don't understand half of what you say!!!

Finally like me and GOOGLE TRANSLATE

It's the proof that we can smile without understand

Yeeeees !! the only THREAD with one thousand question and no answerKwai, I think we should start a separate thread titled "Kwai chang caine's coding questions!" where you can post away! Better still, perhaps one of the mods will open up a new forum section just for you?

FRED even abandoned to answer to me.
I'm sure he believe i'm crazy

Or perhaps, he said to him : "If i answer only one time at one of this thousand question, i'm dead

In fact KCC is like the SCOTCH, or the CHEWING-GUM under the shoes.
impossible to separate it

It's the reason why, even he is french, i have never speak to GOD.
Well, i love you all.......
When I grow up I want to be SROD, FLYPE, GNOZAL, TSSOFT, KIFFI, SPARKIE, NETMAESTRO ...... :roll:
Your code is like the music for my eyes

Each time, i click run in my IDE, i'm like a kid the day of christmas

For you all, it's programming, for me it's each time a miracle

And your kindness is equal at your knowledge
In fact, you and me it's the DREAM TEAM.......
I have all the question, and you have all the answer

I said that often, but my dream is the same that your nightmare.........,
..............BE YOUR FRIEND.............

But i'm proud.
I was already the jester of FLYPE

Now i'm the IDIOT of SROD

I moove i moove in the programing, I have two promoted


Not a destination
First i must say that this lib is very nice!!!
Now i have one question.
I play with WMI and it works very well but i have a problem if i want receive informations about the CPU.
I use "Win32_Processor" and my problem is now that it works fine if the CPU is a single core CPU but if you have a 2 Core or more CPU i receive every time only the datas from CPU0 (DeviceID).
How can i receive also the next Devices with COMate?
Thanks,
Nico
Now i have one question.
I play with WMI and it works very well but i have a problem if i want receive informations about the CPU.
I use "Win32_Processor" and my problem is now that it works fine if the CPU is a single core CPU but if you have a 2 Core or more CPU i receive every time only the datas from CPU0 (DeviceID).
How can i receive also the next Devices with COMate?
Thanks,
Nico
my live space
Can you post your code?
Here's some that I've just run. With a core 2 processor it only lists cpu0. Should it list two?
Here's some that I've just run. With a core 2 processor it only lists cpu0. Should it list two?
Code: Select all
IncludePath "..\..\"
XIncludeFile "COMate.pbi"
Procedure Get_Processors()
Protected objWMIService.COMateObject, processor.COMateObject
Protected colProcessor.COMateEnumObject
strComputer.s = "."
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colProcessor = objWMIService\CreateEnumeration("ExecQuery('Select * FROM Win32_Processor')")
If colProcessor
processor = colProcessor\GetNextObject()
While processor
Debug processor\GetStringProperty("DeviceID")
processor\Release()
processor = colProcessor\GetNextObject()
Wend
colProcessor\Release()
EndIf
objWMIService\Release()
EndIf
EndProcedure
Get_Processors()
I may look like a mule, but I'm not a complete ass.
srod wrote:Can you post your code?
Code: Select all
XIncludeFile "COMate.pbi"
Procedure.s WMI_CPU_Info()
Define.COMateObject objWMIService, CPU
cenuCPU.COMateEnumObject
strComputer.s = "."
Net_I_Index$ = Str(Interface_Index)
objWMIService = COMate_GetObject("winmgmts:\" + strComputer + "\root\cimv2", "")
If objWMIService
cenuCPU = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_Processor')")
If cenuCPU
CPU= cenuCPU\GetNextObject()
While CPU
Debug "Caption = " + CPU\GetStringProperty("Caption")
Debug "Name = " + CPU\GetStringProperty("Name")
Debug "DeviceID = " + CPU\GetStringProperty("DeviceID")
Debug "MaxClockSpeed = " + Str(CPU\GetIntegerProperty("MaxClockSpeed"))
CPU\Release()
CPU = cenuCPU\GetNextObject()
Wend
cenuCPU\Release()
EndIf
objWMIService\Release()
EndIf
EndProcedure
WMI_CPU_Info()
Thanks,
Nico
my live space