COMate - control COM objects via automation - OBSOLETE!

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

Post by Kwai chang caine »

SROD...... i don't say i love you, because i know that's unnerve you :oops:
But i'm so happy :D

You are more quick than lucky lucke
In again a few time ...you give the answer before the question :shock:

I have just replace, the "False" by "Faux" in french
You see, i move a little bit in programming :lol:

I don't want to overuse of your kindness, but have you a tips for this #"¤$$*$ of button :D
It's crazy, the button of the web page are never the same :?
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...

Post by srod »

No sorry.
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

Post by Kwai chang caine »

Never mind i'm already so proud of you.
And you have help me so much 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...

Post by srod »

Kwai, to avoid the "False", "Faux", use the following instead :

Code: Select all

;/////////////////////////////////////////////////////////////////////////////////
;***COMate***  COM automation through iDispatch.
;*===========
;*
;*Execute JavaScript in WebGadget demo by Timo Harter (Freak), Ricardo and Stephen Rodriguez.
;/////////////////////////////////////////////////////////////////////////////////

IncludePath "..\"
XIncludeFile "COMate.pbi"

Enumeration 
  
 #FormWeb 
 #WebGadget 
  
EndEnumeration 

Procedure.i ExecuteJavaScript(Gadget, Command$) 

 Protected browser.COMateObject,documentDispatch.COMateObject, script.COMateObject 
 Protected result 
 browser = COMate_WrapCOMObject(GetWindowLong_(GadgetID(Gadget), #GWL_USERDATA)) 
  
 If browser 
  
  documentDispatch = browser\GetObjectProperty("Document") 
  
  If documentDispatch 
    script = documentDispatch\GetObjectProperty("script") 
    If script 
      
      result = script\Invoke("eval('" + command$ + "')") 
      
      If Result < 0 
       Debug COMate_GetLastErrorDescription() 
      EndIf 
      script\release() 
      
    EndIf  
    documentDispatch\Release() 
  EndIf 
  
  browser\Release() 
  
 EndIf 
  
 ProcedureReturn result 
  
EndProcedure 

Define.COMateObject WebObject 

OpenWindow(#FormWeb, 0, 0, 800, 600, "", #PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered) 
WebGadget(#WebGadget, 10, 10, WindowWidth(#FormWeb) - 20, WindowHeight(#FormWeb) - 60, "") 
SetGadgetText(#WebGadget, "https://signin.ebay.fr/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=71&ru=http%3A%2F%2Fcgi5.ebay.fr%2Fws2%2FeBayISAPI.dll%3FSellItem%26hm%3Dnu.s5tjbhnm575%26%26hc%3D1%26guest%3D1&pageType=1144") 
  

WebObject = COMate_WrapCOMObject(GetWindowLong_(GadgetID(#WebGadget), #GWL_USERDATA)) 
status=-1
If WebObject 
  While Status 
    While WindowEvent():Delay(1):Wend 
    Status = WebObject\GetIntegerProperty("Busy") 
  Wend 
  WebObject\Release() 
EndIf 


ExecuteJavaScript(#WebGadget, "document.all.userid.value=" + Chr(34) + "xxxxx" + Chr(34)) 
ExecuteJavaScript(#WebGadget, "document.all.pass.value=" + Chr(34) + "xxxxx" + Chr(34)) 


Repeat  
 Evenement = WaitWindowEvent () 
Until Evenement = #PB_Event_CloseWindow
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

Post by Kwai chang caine »

Thanks a lot SROD :D
You are a mother for me 8)

You are perhaps proud of me,....... because KCC not turn round his thumb since last question, i ask to you :D
I have found a solution for clik on the button

I put her, if you are interesting or if somebody need to buy automatically to Ebay a day, in the same time that he sleep :lol:

For click on the left button "S'inscrire"

Code: Select all

ExecuteJavaScriptGadget(#WebGadget, "document.forms[0].submit()") 
For click on the right button "Ouvrir une session"

Code: Select all

ExecuteJavaScriptGadget(#WebGadget, "document.forms[1].submit()") 
This is your splendid code bad modify by KCC for open your account, if obviously you have a account in EBAY France :D

Code: Select all

;///////////////////////////////////////////////////////////////////////////////// 
;***COMate***  COM automation through iDispatch. 
;*=========== 
;* 
;*Execute JavaScript in WebGadget demo by Timo Harter (Freak), Ricardo and Stephen Rodriguez. 
;///////////////////////////////////////////////////////////////////////////////// 

IncludePath "..\" 
XIncludeFile "COMate.pbi" 

Enumeration 
  
 #FormWeb 
 #WebGadget 
  
EndEnumeration 

Procedure Waiting()
 
 Define.COMateObject WebObject 
 WebObject = COMate_WrapCOMObject(GetWindowLong_(GadgetID(#WebGadget), #GWL_USERDATA)) 
 status=-1 
 If WebObject 
   While Status 
     While WindowEvent():Delay(1):Wend 
     Status = WebObject\GetIntegerProperty("Busy") 
   Wend 
   WebObject\Release() 
 EndIf 
 
EndProcedure

Procedure.i ExecuteJavaScript(Gadget, Command$) 

 Protected browser.COMateObject,documentDispatch.COMateObject, script.COMateObject 
 Protected result 
 browser = COMate_WrapCOMObject(GetWindowLong_(GadgetID(Gadget), #GWL_USERDATA)) 
  
 If browser 
  
  documentDispatch = browser\GetObjectProperty("Document") 
  
  If documentDispatch 
    script = documentDispatch\GetObjectProperty("script") 
    If script 
      
      result = script\Invoke("eval('" + command$ + "')") 
      
      If Result < 0 
       Debug COMate_GetLastErrorDescription() 
      EndIf 
      script\release() 
      
    EndIf  
    documentDispatch\Release() 
  EndIf 
  
  browser\Release() 
  
 EndIf 
  
 ProcedureReturn result 
  
EndProcedure 

OpenWindow(#FormWeb, 0, 0, 800, 600, "", #PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered) 
WebGadget(#WebGadget, 10, 10, WindowWidth(#FormWeb) - 20, WindowHeight(#FormWeb) - 60, "") 
SetGadgetText(#WebGadget, "https://signin.ebay.fr/ws/eBayISAPI.dll?SignIn&UsingSSL=1&pUserId=&co_partnerId=2&siteid=71&ru=http%3A%2F%2Fcgi5.ebay.fr%2Fws2%2FeBayISAPI.dll%3FSellItem%26hm%3Dnu.s5tjbhnm575%26%26hc%3D1%26guest%3D1&pageType=1144") 
Waiting()
ExecuteJavaScript(#WebGadget, "document.all.userid.value=" + Chr(34) + "xxxxx" + Chr(34)) ; <====== Change for your username
ExecuteJavaScript(#WebGadget, "document.all.pass.value=" + Chr(34) + "xxxxx" + Chr(34)) ; <====== Change for your password
Waiting()
ExecuteJavaScript(#WebGadget, "document.forms[1].submit()") 

Repeat  
 Evenement = WaitWindowEvent () 
Until Evenement = #PB_Event_CloseWindow
Again thanks my good SROD 8)
You and me it's the dream team :lol: :lol:
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

Hello SROD

I have a question who run in my head.
I have put the Define.COMateObject WebObject in the procedure and that's works fine like this 8)

Code: Select all

Procedure Waiting() 
  
 Define.COMateObject WebObject 
 WebObject = COMate_WrapCOMObject(GetWindowLong_(GadgetID(#WebGadget), #GWL_USERDATA)) 
 status=-1 
 If WebObject 
   While Status 
     While WindowEvent():Delay(1):Wend 
     Status = WebObject\GetIntegerProperty("Busy") 
   Wend 
   WebObject\Release() 
 EndIf 
  
EndProcedure
I want to know if it's possible to put it out the procedure in global for all the program ??? :roll:
Because i can't find a place out of the procedure who it is recognized :cry:
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...

Post by srod »

Well yes, you can make it global if you want - like any variable.
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

Post by Kwai chang caine »

Like usually, i don't understand :oops:
I'm alone to can't declare this object GLOBAL :cry:

Because before disturb you, i have try several ways :

Code: Select all

Global COMateObject WebObject
Global.COMateObject WebObject
Global Define.COMateObject WebObject
And always an error :cry:
Decidedly..... i'm really a wafer :oops:
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

Post by Kiffi »

Code: Select all

Global WebObject.COMateObject
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

Post by Kwai chang caine »

You too you are always here when Wafer KCC have problem
I have thinking at all, without this way :?

So......even it's a little bit more difficult for found this answer....
I assume totally that i say :oops:

Image

Thanks a lot my good KIFFI 8)
ImageThe happiness is a road...
Not a destination
glops
User
User
Posts: 38
Joined: Wed Jan 16, 2008 12:53 pm
Location: France

LOL of LOL

Post by glops »

oh my god, thanks to you KCC, I forget there is a crisis in the world when I read your posts ! dammm...how to stop to laugh now ?
When I try to imagine how you try to compile 1 prog, with all your questions, I just begin to smile ! TY
:D
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: LOL of LOL

Post by srod »

glops wrote:... When I try to imagine how you try to compile 1 prog, with all your questions, I just begin to smile ! TY
:D
I don't think KCC compiles his programs! Instead, I reckon he throws them at his bedroom wall and if they don't stick to the wall then he decides there must be a bug within the code! :wink:
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

Post by Kwai chang caine »

glops wrote:When I try to imagine how you try to compile 1 prog
Great SROD wrote:I don't think KCC compiles his programs
Compiles programs :shock:
What is it ??? :shock:
Aaaahhh !! it's for that !!!!!
I must compile all the programs before use it :D
It's for that, it never works :lol: :lol: :lol:

Me i replace the .pb extension by .exe, and i sell it in all the word :oops:
It's the reason why, i have go bankrupt all my enterprise of software since several years ago :roll:

Thanks for your great tips....... :D
KCC remember now !!!!
Before distribute program exe......KCC must click on the little worm drive in the PB IDE 8)

You are really friends for me, to say me your great secret tips :
"Compile before use"
:lol: :lol:
ImageThe happiness is a road...
Not a destination
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Post by Kwai chang caine »

oh my god, thanks to you KCC, I forget there is a crisis in the world when I read your posts ! dammm...how to stop to laugh now ?
When I try to imagine how you try to compile 1 prog, with all your questions, I just begin to smile ! TY
Thanks for your kind compliment.
He go directly in my heart and make me a smile 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...

Post by srod »

Me i replace the .pb extension by .exe, and i sell it in all the word :oops:
LOL! :lol: :lol:
I may look like a mule, but I'm not a complete ass.
Post Reply