Posted: Sat Feb 28, 2009 11:28 pm
OK, that works now. I thought I had already done that.srod wrote:Code: Select all
datetime\Invoke("SetFileTime('" + file_x$ + "')")
http://www.purebasic.com
https://www.purebasic.fr/english/
OK, that works now. I thought I had already done that.srod wrote:Code: Select all
datetime\Invoke("SetFileTime('" + file_x$ + "')")
Code: Select all
datetime\Invoke("SetFileTime('file_x$')")
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$')")
SFSxOI wrote:ARGGGGhhhhhhhhh!
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>
Code: Select all
If script
result = script\Invoke("eval('" + command$ + "')")
Debug COMate_GetLastErrorDescription()
script\release()
EndIf
COMATE the baby of Great SROD wrote:Unknown error. (Code : Hex FFFFFFFF80070005). Please report this error code to the author at 'enquiries@nxsoftware.com'
Code: Select all
While Status$ <> "Terminé"
Status$ = HTTPObject\GetStringProperty("StatusText")
Delay(10)
Wend
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
Code: Select all
While Status$ <> "Terminé"
Status$ = HTTPObject\GetStringProperty("StatusText")
Delay(10)
Wend
Code: Select all
While Status$ <> "False"
Status$ = HTTPObject\GetStringProperty("Busy")
Delay(10)
Wend
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
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