OK, that works now. I thought I had already done that.srod wrote:Code: Select all
datetime\Invoke("SetFileTime('" + file_x$ + "')")
COMate - control COM objects via automation - OBSOLETE!
You were using
at least in the code you posted earlier. This of course will mean nothing to COMate.
Code: Select all
datetime\Invoke("SetFileTime('file_x$')")
I may look like a mule, but I'm not a complete ass.
srod wrote:You were usingat least in the code you posted earlier. This of course will mean nothing to COMate.Code: Select all
datetime\Invoke("SetFileTime('file_x$')")
ARGGGGhhhhhhhhh!
According to the docs (and backed up by my ole viewer) the booleans are variant booleans and this thus suggests that you should be using #True etc. (COMate automatically converts these to variant booleans).
Using strings should be okay providing the object is ready to convert such values.
Using strings should be okay providing the object is ready to convert such values.
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
Hello SROD, it's me
I don't understand
I have an internal page HTTPS and i can't write and submit like the page "http://www.penguinbyte.com/apps/pbwebstor/logon.php" for example
I have try several things but the Return of result is negative = -2147024891
Then when it's works the return is 0
And the more funny, it's that with the webgadget that works
Is it normal ????
Or it's me who is again a wafer
And this is the page
Thanks

I don't understand

I have an internal page HTTPS and i can't write and submit like the page "http://www.penguinbyte.com/apps/pbwebstor/logon.php" for example
I have try several things but the Return of result is negative = -2147024891

Then when it's works the return is 0
And the more funny, it's that with the webgadget that works

Is it normal ????
Or it's me who is again a wafer

Code: Select all
Procedure.i ExecuteJavaScript(browser.COMateObject , command$)
Protected documentDispatch.COMateObject, script.COMateObject
Protected result
If browser
documentDispatch = browser\GetObjectProperty("Document")
If documentDispatch
script = documentDispatch\GetObjectProperty("script")
If script
result = script\Invoke("eval('" + command$ + "')")
script\release()
EndIf
documentDispatch\Release()
EndIf
EndIf
ProcedureReturn result
EndProcedure
Define.COMateObject WebObject
HTTPObject.COMateObject
HTTPObject = COMate_CreateObject("InternetExplorer.Application")
If HTTPObject
HTTPObject\SetProperty("Visible= #True")
HTTPObject\invoke("Navigate('https://xxxxxxx/index.jsp')")
While status$ <> "Terminé"
Status$ = HTTPObject\GetStringProperty("StatusText")
Delay(10)
Wend
ExecuteJavaScript(HTTPObject,"document.all.login.value=" + Chr(34) + "xxxxx" + Chr(34))
ExecuteJavaScript(HTTPObject,"document.all.password.value=" + Chr(34) + "xxxxxxxx" + Chr(34))
ExecuteJavaScript(HTTPObject,"document.myform.submit()")
HTTPObject\Release()
EndIf
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>
Authentification
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="shortcut icon" href="/images/icone.ico">
<script language="javascript">
If (document.layers) {
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/style.css\">");
} Else {
document.write("<link rel=\"stylesheet\" type=\"text/css\" href=\"/styles/style.css\">");
}
</script>
<script language='javascript'>
history.forward();
</script>
</head>
<body class="login" >
<form action="/login" method="post" name="myform">
<table width="450">
<tr>
<td class="ariane">
<div class="arianeModule">
Authentification
</div>
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="10" height="10"><img src="/images/bloc_a_hg.gif" width="10" height="10"></td>
<td height="10" bgcolor="#B9C1ED"><img src="/images/pix.gif" width="1" height="1"></td>
<td width="10" height="10"><img src="/images/bloc_a_hd.gif" width="10" height="10"></td>
</tr>
</table>
</td>
</tr>
<tr class="bandeau">
<td class="erreur">
</td>
</tr>
<tr>
<td>
<table width="100%" class="bandeau">
<tr>
<td class="premiere">
Identifiant :
</td>
<td>
<input name="login" type="text" class="input" size="30" />
</td>
</tr>
<tr>
<td class="premiere">
Mot de passe :
</td>
<td>
<input name="password" type="password" class="input" size="30" />
</td>
</tr>
<tr>
<td class="premiere">
Portail :
</td>
<td>
<Select name="portail" class="input" />
<option value="ENC">
Programmation et Pilotage des Interventions
</option>
<option value="PIL">
Administration et Suivi d'Activité
</option>
</Select>
</td>
</tr>
</table>
</td>
</tr>
<tr class="bandeau">
<td class="actions">
<input type="image" src="/images/bt_valider_bleu1024.gif" value="login" />
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td width="10" height="10"><img src="/images/bloc_a_bg.gif" width="10" height="10"></td>
<td height="10" bgcolor="#B9C1ED"><img src="/images/pix.gif" width="1" height="1"></td>
<td width="10" height="10"><img src="/images/bloc_a_bd.gif" width="10" height="10"></td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="erreur">
</td>
</tr>
</table>
</form>
<script language="JavaScript">document.myform.login.focus();</script>
</body>
</html>
Last edited by Kwai chang caine on Mon Mar 02, 2009 2:38 pm, edited 1 time in total.

Not a destination
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Oooooh, i'm again impressive
I have write that
And your baby, say to me, that i must say to you :

I have write that
Code: Select all
If script
result = script\Invoke("eval('" + command$ + "')")
Debug COMate_GetLastErrorDescription()
script\release()
EndIf
And your baby, say to me, that i must say to you :
COMATE the baby of Great SROD wrote:Unknown error. (Code : Hex FFFFFFFF80070005). Please report this error code to the author at 'enquiries@nxsoftware.com'

Not a destination
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
That is an 'access denied' error.
It's crazy, because i use the same instruction with the webgadget that with the IE client
And with the webgadget that's works
It's perhaps the HTTPS the problem or also the java :roll:
Good, i continue to search
Thanks SROD

It's crazy, because i use the same instruction with the webgadget that with the IE client

And with the webgadget that's works

It's perhaps the HTTPS the problem or also the java :roll:
Good, i continue to search
Thanks SROD

Last edited by Kwai chang caine on Mon Mar 02, 2009 4:13 pm, edited 1 time in total.

Not a destination
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
Have you a good method to see, the state of loading of the page.
Because, this method works fine, but only in an objet client IE
But i search the same with a webgadget
I have try this but it's not full and not sure
Because, this method works fine, but only in an objet client IE
Code: Select all
While Status$ <> "Terminé"
Status$ = HTTPObject\GetStringProperty("StatusText")
Delay(10)
Wend
I have try this but it's not full and not sure

Code: Select all
#READYSTATE_UNINITIALIZED = 0
; The control is waiting to be initialized
#READYSTATE_LOADING = 1
; The control is initializing itself through
; one Or more asynchronous properties. Some
; property values might not be available.
#READYSTATE_LOADED = 2
; The control has returned from IPersist*::Load
; so that all its properties are available And
; it has started any asynchronous Data transfers.
; The control's properties are available and it is
; ready To draw at least something through IViewObject::draw.
; Making properties available doesn't necessarily require
; The control's type information.
#READYSTATE_INTERACTIVE = 3
; The control is capable of interacting with the user in at
; least some limited sense And can supply its type information.
; Full interaction may not be available Until all asynchronous
; Data arrives
#READYSTATE_COMPLETE = 4
; The control is completely ready for all requests.
If OpenWindow(0, 10, 10, 700, 500, "WebGadget ReadyState", #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
StatusBar= CreateStatusBar(0, WindowID(0))
If StatusBar
AddStatusBarField(120)
AddStatusBarField(300)
StatusBarText(0, 1, "")
EndIf
If CreateGadgetList(WindowID(0))
WebGadget(0, 10, 10, 680, 460, "http://www.purebasic.com")
WebObject.IWebBrowser2 = GetWindowLong_(GadgetID(0), #GWL_USERDATA) ; needed for accessing IWebBrowser interface
ProgressBarGadget(1, 10, 6, 100, 12, 0, 100)
SetParent_(GadgetID(1), StatusBar)
EndIf
EndIf
count=0
Repeat
Event = WaitWindowEvent()
If isBusy
WebObject\get_ReadyState(@isReady)
Select isReady
Case 1
; il faudrait ajouter une fonction pour vérifier que l'accès internet est autorisé,
; afin de commencer le comptage.
If count<90
count=count+1
SetGadgetState(1,count)
EndIf
StatusBarText(0, 1, "Page Loading")
Case 2
StatusBarText(0, 1, "Page Loaded")
Case 3
StatusBarText(0, 1, "Page is interactive with some data missing")
Case 4
StatusBarText(0, 1, "Page finished loading")
SetGadgetState(1,100)
EndSelect
EndIf
WebObject\get_busy(@isBusy)
Until Event = #PB_Event_CloseWindow
End

Not a destination
- Kwai chang caine
- Always Here
- Posts: 5494
- Joined: Sun Nov 05, 2006 11:42 pm
- Location: Lyon - France
SROD you have not a way to use this code for a WebGadget ??

Code: Select all
While Status$ <> "Terminé"
Status$ = HTTPObject\GetStringProperty("StatusText")
Delay(10)
Wend

Not a destination
Code: Select all
While Status$ <> "False"
Status$ = HTTPObject\GetStringProperty("Busy")
Delay(10)
Wend
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
Excuse me, but i have not understand your answer
I have two problem
1/ how replace the MessageRequester, to a loop, who wait the end of load (This is my above question)
2/ I have try several method for clic on this #"¤$$*$ of button, and nothing to do
This is not again the same button that the purebasic forum, it have not a name, just tabindex or class
Please can you say to me a way

I have two problem
1/ how replace the MessageRequester, to a loop, who wait the end of load (This is my above question)
2/ I have try several method for clic on this #"¤$$*$ of button, and nothing to do

This is not again the same button that the purebasic forum, it have not a name, just tabindex or class

Code: Select all
<td align="right"><button type="submit" tabindex="3" class="SIActBtn"><span class="btn"><span class="btn">Ouvrir une session</span></span></button></td>

Code: Select all
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")
While WindowEvent():Delay(1):Wend
MessageRequester("Essai", "Ok") ; <======= How replace this by a loop of wait
ExecuteJavaScript(#WebGadget, "document.all.userid.value=" + Chr(34) + "xxxxx" + Chr(34))
ExecuteJavaScript(#WebGadget, "document.all.pass.value=" + Chr(34) + "xxxxx" + Chr(34))
MessageRequester("Essai", "Ok") ; <======= How replace this by a loop of wait
;ExecuteJavaScript(#WebGadget, "document.all.btn.click()") ; Don't works
;ExecuteJavaScript(#WebGadget, "document.all.SIActBtn.click()") ; Don't works
;ExecuteJavaScript(#WebGadget, "document.all.click()") ; Don't works
;ExecuteJavaScript(#WebGadget, "document.all.submit.click()") ; Don't works
;ExecuteJavaScript(#WebGadget,"document.oPage.submit()") ; Don't works
;ExecuteJavaScript(#WebGadget,"document.ebay.oDocument.oPage.submit()") ; Don't works
;ExecuteJavaScript(#WebGadget,"document.ebay.submit()") ; Don't works
;ExecuteJavaScript(#WebGadget,"document.ebay.oDocument.submit()") ; Don't works
Repeat
Evenement = WaitWindowEvent ()
Until Evenement = #PB_Event_CloseWindow

Not a destination
The following code is really very inefficient, but it works okay here :
Code: Select all
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))
If WebObject
While Status$ <> "False"
While WindowEvent():Delay(1):Wend
Status$ = WebObject\GetStringProperty("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.